Beispiel #1
0
        public JsonResult AddUpdateCI(LP_CI_ViewModel objpurchase)
        {
            try
            {
                bool flag = false;


                _objCIMaster          = new LP_CI_PurchaseOrder_Property();
                _objCIMaster.poNumber = objpurchase.poNumber;
                _objCIMaster.PINO     = objpurchase.PINO;
                //_objCIMaster.purchaseDate = objpurchase.purchaseDate;
                _objCIMaster.purchaseDate  = objpurchase.purchaseDate;
                _objCIMaster.description   = objpurchase.description;
                _objCIMaster.totalAmount   = objpurchase.totalAmount;
                _objCIMaster.netAmount     = objpurchase.netAmount;
                _objCIMaster.paidAmount    = objpurchase.paidAmount;
                _objCIMaster.balanceAmount = objpurchase.balanceAmount;
                // _objCIMaster.DocumentNumber = objpurchase.DocumentNumber;
                // _objCIMaster.ContainerNo = objpurchase.ContainerNo;
                // _objCIMaster.ExchangeRate = objpurchase.ExchangeRate;
                // _objCIMaster.DepartmentID = objpurchase.DepartmentID;
                //  _objCIMaster.paidDate = ;// objpurchase.paidDate;

                _objCIMaster.DetailData = Helper.ToDataTable <LP_CI_PurchaseDetails_Property>(objpurchase.CILIST);
                if (objpurchase.idx > 0)
                {
                    _objCIMaster.idx              = objpurchase.idx;
                    _objCIMaster.creationDate     = DateTime.Now;
                    _objCIMaster.visible          = 1;
                    _objCIMaster.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    _objCIMaster.visible          = 1;
                    _objCIMaster.status           = "0";
                    _objCIMaster.TableName        = "CommercialDetails";
                    objpurchaseBll = new LP_PI_BLL();
                    flag           = objpurchaseBll.Insert();
                    //update
                }
                else
                {
                    //add
                    _objCIMaster.creationDate     = DateTime.Now;
                    _objCIMaster.visible          = 1;
                    _objCIMaster.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    _objCIMaster.visible          = 1;
                    _objCIMaster.status           = "0";
                    _objCIMaster.TableName        = "CommercialDetails";
                    objpurchaseBll = new LP_PI_BLL(_objCIMaster);
                    flag           = objpurchaseBll.InsertCIPO();
                }
                return(Json(new { data = "", success = flag, msg = flag == true ? "Successfull" : "Failed", statuscode = flag == true ? 200 : 401 }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #2
0
 public LP_PI_BLL(LP_CI_PurchaseOrder_Property objci)
 {
     _objCIMaster = objci;
 }