Exemplo n.º 1
0
        public static bool Insert_ProdMaster(ProdReceiptVM model, string dealerCode, ref string msg)
        {
            try
            {
                if (model.RecNo == "0" || model.RecNo == "" || model.RecNo == null)
                {
                    strAutoCode = sysfun.AutoGen("ProdRecMaster", "RecNo", DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("dd/MM/yyyy"), model.DealerCode);
                    //strAutoCode = sysfun.GetNewMaxID("ProdRecMaster", "RecNo", 8, "00166");
                    //recDate = DateTime.Parse( model.RecDate);
                }
                else
                {
                    strAutoCode = model.RecNo;
                    //string rec = model.RecDate;
                    //recDate = DateTime.Parse(rec);
                }
                SqlParameter[] param =
                {
                    new SqlParameter("@DealerCode", model.DealerCode),                            //0
                    new SqlParameter("@RecNo", strAutoCode),                                      //1
                    new SqlParameter("@RecDate", sysfun.SaveDate(model.RecDate)),                 //2
                    new SqlParameter("@DocumentNo", model.DocumentNo),                            //3
                    new SqlParameter("@UpdUser", AuthBase.UserId),                                //4
                    new SqlParameter("@UpdTerm", General.CurrentIP),                              //5
                    new SqlParameter("@VehTypeCode", model.VehTypeCode),                          //6
                    new SqlParameter("@VehRecCode", model.VehRecCode),                            //7
                    new SqlParameter("@Segment", model.Segment.Trim()),                           //8
                    new SqlParameter("@Category", model.Category.Trim()),                         //9
                    new SqlParameter("@Usage", model.Usage.Trim()),                               //10
                    new SqlParameter("@VendorCode", model.VendorCode.Trim()),                     //11
                    new SqlParameter("@Remarks", model.Remarks),                                  //12
                    new SqlParameter("@OEMAnnounceDate", sysfun.SaveDate(model.OEMAnnounceDate)), //12
                    new SqlParameter("@TransportID", model.TransportID),                          //12
                    new SqlParameter("@TotalVehicleAmount", model.TotalVehicleAmount)             //12
                };

                if (ObjTrans.BeginTransaction(ref Trans) == true)
                {
                    sysfun.ExecuteSP_NonQuery("SP_ProdRecMaster_Insert", param, Trans);


                    IsSaved = true;
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return(false);
            }

            return(IsSaved);
        }
Exemplo n.º 2
0
        public JsonResult Insert_ProdRecMaster(ProdReceiptVM ProdReceiptVM)
        {
            bool result = false;

            DealerCode = Session["DealerCode"].ToString();
            string msg = "Failed to save record..";

            result = VehReceiptMethods.Insert_ProdMaster(ProdReceiptVM, DealerCode, ref msg);

            if (result)
            {
                msg = "Successfully Added";
            }

            return(Json(new { Success = result, Message = msg }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public JsonResult Insert_ProdRecMaster(ProdReceiptVM ProdReceipt)
        {
            bool result = false;
            DealerCode = Session["DealerCode"].ToString();
            string msg = "Failed to save record..";
            if (ProdReceipt.RecNo != null && ProdReceipt.RecNo != "0")
            {
                if (Core.CRM.ADO.SecurityBll.UserRights("2015", "003"))
                {
                    
                    result = VehReceiptMethods.Insert_ProdMaster(ProdReceipt, DealerCode, ref msg);
                    if (result)
                    {
                        msg = "Successfully Added";
                    }
                }
                else
                {
                    msg = "You dn't have a right! Please Contact to Administrator";
                    result = false;
                }
            }
            else
            {
                result = VehReceiptMethods.Insert_ProdMaster(ProdReceipt, DealerCode, ref msg);
                if (result)
                {
                    msg = "Successfully Added";
                }
            }
           

         

            return Json(new { Success = result, Message = msg }, JsonRequestBehavior.AllowGet);
        }