Esempio n. 1
0
        public static bool Insert_Buying(BuyingCusVehicleVM model, string dealerCode)
        {
            try
            {
                if (string.IsNullOrEmpty(model.BuyingCode))
                {
                    if (sysfun.IsExist("RegNo", model.RegNo, "UCS_Buying", dealerCode))
                    {
                        return(IsSaved);
                    }
                    strAutoCode = sysfun.AutoGen("UCS_Buying", "BuyingCode", DateTime.Parse(DateTime.Now.ToShortDateString()).ToString("dd/MM/yyyy"), dealerCode);
                    //strAutoCode = sysfun.GetNewMaxID("UCS_Buying", "BuyingCode", 8, dealerCode);
                }
                else
                {
                    strAutoCode = model.BuyingCode;
                }


                SqlParameter[] param =
                {
                    new SqlParameter("@DealerCode         ",         dealerCode),                                //0
                    new SqlParameter("@BuyingCode         ",         strAutoCode),                               //1
                    new SqlParameter("@BuyingDate         ",         sysfun.SaveDate(model.BuyingDate)),         //3
                    new SqlParameter("@RegNo              ",         model.RegNo),                               //5
                    new SqlParameter("@KM                 ",         model.KM),                                  //6
                    new SqlParameter("@RoadTaxPaid        ",         model.RoadTaxPaid),                         //7
                    new SqlParameter("@RoadTaxValidUpTo    ",        sysfun.SaveDate(model.RoadTaxValidUpTo)),   //8
                    new SqlParameter("@IsInsured          ",         model.IsInsured),                           //9
                    new SqlParameter("@InsuranceValidUpTo ",         sysfun.SaveDate(model.InsuranceValidUpTo)), //10
                    new SqlParameter("@BuyingPrice        ",         Convert.ToDecimal(model.BuyingPrice)),      //11
                    new SqlParameter("@EvaluationCode      ",        model.EvaluationCode),                      //12
                    new SqlParameter("@EvaluationDate     ",         sysfun.SaveDate(model.EvaluationDate)),     //13
                    new SqlParameter("@Pic01              ",         model.Pic01),                               //19
                    new SqlParameter("@Pic02              ",         model.Pic02),                               //20
                    new SqlParameter("@Pic03              ",         model.Pic03),                               //21
                    new SqlParameter("@Pic04              ",         model.Pic04),                               //22
                    new SqlParameter("@Pic05               ",        model.Pic05),                               //23
                    new SqlParameter("@UpdUser             ",        AuthBase.UserId),                           //24
                    new SqlParameter("@UpdTerm            ",         General.CurrentIP),                         //27
                    new SqlParameter("@LocationCode               ", model.LocationCode),
                    new SqlParameter("@BuyingMode               ",   model.BuyingMode)
                };
                if (ObjTrans.BeginTransaction(ref Trans) == true)
                {
                    sysfun.ExecuteSP_NonQuery("Insert_Buying", param, Trans);


                    IsSaved = true;
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(IsSaved);
        }
Esempio n. 2
0
        public JsonResult Insert_Buying(BuyingCusVehicleVM Objects)
        {
            Objects.Pic01 = Session["FrontImg"].ToString();
            Objects.Pic02 = Session["BackImg"].ToString();
            Objects.Pic03 = Session["LeftImg"].ToString();
            Objects.Pic04 = Session["RightImg"].ToString();
            Objects.Pic05 = Session["TopImg"].ToString();
            string dealerCode = Session["DealerCode"].ToString();
            bool   result     = false;

            string msg = "Failed to save record..";


            result = BuyingCusVehicleMethods.Insert_Buying(Objects, dealerCode);

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

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