Home > Net >  Consult Easyui editable datagrid code,
Consult Easyui editable datagrid code,

Time:09-17

Recently in use Easyui framework to do invoicing system, at present the problems is to make the new documents (divided into header and body), but the changes don't know how to realize the function of, labeled images and code, consult the great god help resolve, as the chart

The code is as follows:///& lt; Summary>
///add and modify the purchase order
///& lt;/summary>
///& lt; Returns>
Public ContentResult PurchaseSave ()
{
CusMessage clsResult=new CusMessage ();//return the result structure
Trans sqlTran=new Trans ();
Try
{
List LstFields=new List (a);
ModelField mdlSeriesId=new ModelField {FieldName="SeriesId"};
LstFields. Add (mdlSeriesId);
ModelField mdlcPOID=new ModelField {FieldName="cPOID"};
LstFields. Add (mdlcPOID);
ModelField mdldPODate=new ModelField {FieldName="dPODate"};
LstFields. Add (mdldPODate);
ModelField mdlcVenCode=new ModelField {FieldName="cVenCode"};
LstFields. Add (mdlcVenCode);
ModelField mdlcPersonCode=new ModelField {FieldName="cPersonCode"};
LstFields. Add (mdlcPersonCode);
ModelField mdlcArrivalPlace=new ModelField {FieldName="cArrivalPlace"};
LstFields. Add (mdlcArrivalPlace);
ModelField mdlcexch_code=new ModelField {FieldName="cexch_code"};
LstFields. Add (mdlcexch_code);
ModelField mdliTaxRate=new ModelField {FieldName="iTaxRate"};
LstFields. Add (mdliTaxRate);
ModelField mdlcPayCode=new ModelField {FieldName="cPayCode"};
LstFields. Add (mdlcPayCode);
ModelField mdlcBusType=new ModelField {FieldName="cBusType"};
LstFields. Add (mdlcBusType);
ModelField mdlcMemo=new ModelField {FieldName="cMemo"};
LstFields. Add (mdlcMemo);
ModelField mdlDetail=new ModelField {FieldName="Detail"};
LstFields. Add (mdlDetail);

//get data submitted
Foreach (string Item in Request. Params. AllKeys)
{
Foreach (ModelField FieldItem in lstFields)
{
If (FieldItem FieldName==Item)
{
FieldItem. FieldValue=https://bbs.csdn.net/topics/Request.Params [FieldItem FieldName]. The Trim ();
}
}
}
//organization class data
Bus_PoMain mdlItem=new Bus_PoMain ();

If (the Convert. ToInt32 (mdlSeriesId. FieldValue) & gt; 0)
{
MdlItem. SeriesId=the Convert. ToInt32 (mdlSeriesId FieldValue);
MdlItem. CModifyDate=DateTime. Now;
MdlItem. CReviser="0";
}
The else
{
MdlItem. CMakeDate=DateTime. Now;
MdlItem. CMaker="0";
}
MdlItem. CPOID=the Convert. ToString (mdlcPOID FieldValue);
MdlItem. DPODate=the Convert. ToDateTime (mdldPODate FieldValue);
MdlItem. CPersonCode=the Convert. ToString (mdlcPersonCode FieldValue);
MdlItem. CVenCode=the Convert. ToString (mdlcVenCode FieldValue);
MdlItem. CPersonCode=the Convert. ToString (mdlcPersonCode FieldValue);
MdlItem. CArrivalPlace=the Convert. ToString (mdlcArrivalPlace FieldValue);
MdlItem. Cexch_code=the Convert. ToInt32 (mdlcexch_code FieldValue);
MdlItem. ITaxRate=the Convert. ToDouble (mdliTaxRate FieldValue);
MdlItem. CPayCode=the Convert. ToString (mdlcPayCode FieldValue);
MdlItem. CBusType=the Convert. ToString (mdlcBusType FieldValue);
MdlItem. CMemo=the Convert. ToString (mdlcMemo FieldValue);

Long lid=0;
ClassDBCommon clsDB=new ClassDBCommon ();
DbHelper sqlDB=new DbHelper ();
If (the Convert. ToInt32 (mdlSeriesId. FieldValue)==0)
{
If (clsDB. InsertProcess (mdlItem sqlTran, sqlDB, DBType. Essentially, the out lid))
{
ClsResult. Code=0;//success
}
The else
{
ClsResult. Code=1;//failure
}
}
The else
{
If (clsDB. UpdateProcess (mdlItem sqlDB))
{
ClsResult. Code=0;//success
}
The else
{
ClsResult. Code=1;//failure
}
}
//get back ID post-processing table body
If (the Convert. ToInt32 (mdlSeriesId. FieldValue)==0)
{
If (lid==0)
{
Throw new Exception (" documents first save failed ");
}
}
List LstRD=JsonConvert. DeserializeObject (mdlDetail. FieldValue. ToString ());
Foreach (ModelPurchase Item in lstRD)
{
If (Item InvCode!=null)
{
If (Item) InvCode) Trim ()!="")
{
//save the logical
Bus_PoDetails mdlitems=new Bus_PoDetails ();
Mdlitems. InvCode=the Convert. ToString (Item. InvCode);
Mdlitems. CAppcode=the Convert. ToString (Item. CAppcode);
Mdlitems. CPOID=the Convert. ToString (Item. CPOID);
Mdlitems. IQuantity=the Convert. ToDecimal (Item. IQuantity);
Mdlitems. StockQuantity=the Convert. ToDecimal (Item. StockQuantity);
Mdlitems. ITaxPrice=the Convert. ToDecimal (Item. ITaxPrice);
Mdlitems. IUnitPrice=the Convert. ToDecimal (Item. IUnitPrice);
Mdlitems. TaxAmount=the Convert. ToDecimal (Item. TaxAmount);
Mdlitems. NTaxAmount=the Convert. ToDecimal (Item. NTaxAmount);
Mdlitems. DArriveDate=the Convert. ToDateTime (Item. DArriveDate);
Mdlitems. CbMemo=the Convert. ToString (Item. CbMemo);
Mdlitems. SeriesId=the Convert. ToInt32 (lid);
If (mdlitems. AutoId==0)
{
If (clsDB. InsertProcess (mdlitems sqlTran, sqlDB))
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C #