Exemple #1
0
        public JsonResult AddUpdateConsigment(LP_Consigment_ViewModel objpurchase)
        {
            try
            {
                bool flag = false;


                _objconsigment                  = new LP_Consigment_Property();
                _objconsigment.InvoiceNo        = objpurchase.InvoiceNo;
                _objconsigment.ParentDocumentId = objpurchase.ParentDocumentId;
                //_objCIMaster.purchaseDate = objpurchase.purchaseDate;
                _objconsigment.Invoicedate = objpurchase.Invoicedate;
                _objconsigment.Reference   = objpurchase.Reference;
                //_objconsigment. = objpurchase.totalAmount;
                //_objconsigment.netAmount = objpurchase.netAmount;
                //_objconsigment.paidAmount = objpurchase.paidAmount;
                //_objconsigment.balanceAmount = objpurchase.balanceAmount;
                // _objCIMaster.DocumentNumber = objpurchase.DocumentNumber;
                // _objCIMaster.ContainerNo = objpurchase.ContainerNo;
                // _objCIMaster.ExchangeRate = objpurchase.ExchangeRate;
                // _objCIMaster.DepartmentID = objpurchase.DepartmentID;
                //  _objCIMaster.paidDate = ;// objpurchase.paidDate;
                _objconsigment.CIPODetails = Helper.ToDataTable <LP_CI_PurchaseDetails_Property>(objpurchase.CIDetailsPO);
                _objconsigment.DetailData  = Helper.ToDataTable <LP_ConsigmentDetails>(objpurchase.ConsigmentDetails);
                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
                    _objconsigment.creationDate = DateTime.Now;
                    //_objconsigment.visible = 1;
                    _objconsigment.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    //_objconsigment.visible = 1;
                    _objconsigment.status    = 0;
                    _objconsigment.TableName = "consigmentdetails";
                    objpurchaseBll           = new LP_PI_BLL(_objconsigment);
                    flag = objpurchaseBll.InsertConsigment();
                }
                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));
            }
        }
Exemple #2
0
        public JsonResult AddUpdate(LP_PerformaInvoice_ViewModel objpurchase)
        {
            try
            {
                bool flag = false;


                objPurchaseProperty                 = new LP_Performa_Invoice_Property();
                objPurchaseProperty.poNumber        = objpurchase.poNumber;
                objPurchaseProperty.vendorIdx       = objpurchase.vendorIdx;
                objPurchaseProperty.purchaseTypeIdx = objpurchase.purchaseTypeIdx;
                objPurchaseProperty.purchaseDate    = objpurchase.purchaseDate;
                objPurchaseProperty.description     = objpurchase.description;
                objPurchaseProperty.totalAmount     = objpurchase.totalAmount;
                objPurchaseProperty.netAmount       = objpurchase.netAmount;
                objPurchaseProperty.paidAmount      = objpurchase.paidAmount;
                objPurchaseProperty.balanceAmount   = objpurchase.balanceAmount;
                objPurchaseProperty.DocumentNumber  = objpurchase.DocumentNumber;
                objPurchaseProperty.ContainerNo     = objpurchase.ContainerNo;
                objPurchaseProperty.ExchangeRate    = objpurchase.ExchangeRate;
                objPurchaseProperty.DepartmentID    = objpurchase.DepartmentID;
                //  objPurchaseProperty.paidDate = ;// objpurchase.paidDate;

                objPurchaseProperty.DetailData = Helper.ToDataTable <LP_Performa_Invoice_Details_Property>(objpurchase.CommercialDetailList);
                if (objpurchase.idx > 0)
                {
                    objPurchaseProperty.idx              = objpurchase.idx;
                    objPurchaseProperty.creationDate     = DateTime.Now;
                    objPurchaseProperty.visible          = 1;
                    objPurchaseProperty.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    objPurchaseProperty.visible          = 1;
                    objPurchaseProperty.status           = "0";
                    objPurchaseProperty.TableName        = "CommercialDetails";
                    objpurchaseBll = new LP_PI_BLL();
                    flag           = objpurchaseBll.Insert();
                    //update
                }
                else
                {
                    //add
                    objPurchaseProperty.creationDate     = DateTime.Now;
                    objPurchaseProperty.visible          = 1;
                    objPurchaseProperty.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString());
                    objPurchaseProperty.visible          = 1;
                    objPurchaseProperty.status           = "0";
                    objPurchaseProperty.TableName        = "CommercialDetails";
                    objpurchaseBll = new LP_PI_BLL(objPurchaseProperty);
                    flag           = objpurchaseBll.Insert();
                }
                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));
            }
        }