public JsonResult AddBPartnerInfo(int C_BPartner_ID, string searchKey, string name, string name2, string greeting, string bpGroup, string bpRelation, string bpLocation, string contact, string greeting1, string title, string email, string address, string phoneNo, string phoneNo2, string fax, int windowNo, string BPtype, bool isCustomer, bool isVendor)
        {
            Ctx           ctx             = Session["ctx"] as Ctx;
            BPartnerModel objContactModel = new BPartnerModel();
            string        resultMsg       = string.Empty;

            //searchKey = Server.HtmlEncode(searchKey);
            //name = Server.HtmlEncode(name);
            //name2 = Server.HtmlEncode(name2);
            //contact = Server.HtmlEncode(contact);
            //email = Server.HtmlEncode(email);
            //title = Server.HtmlEncode(title);
            //phoneNo = Server.HtmlEncode(phoneNo);
            //phoneNo2 = Server.HtmlEncode(phoneNo2);
            //fax = Server.HtmlEncode(fax);
            if (C_BPartner_ID > 0)
            {
                resultMsg = objContactModel.AddBPartner(searchKey, name, name2, greeting, bpGroup, bpRelation, bpLocation, contact, greeting1, title, email, address, phoneNo, phoneNo2, fax, ctx, windowNo, BPtype, C_BPartner_ID, isCustomer, isVendor); // Update Business Partner
            }
            else
            {
                resultMsg = objContactModel.AddBPartner(searchKey, name, name2, greeting, bpGroup, bpRelation, bpLocation, contact, greeting1, title, email, address, phoneNo, phoneNo2, fax, ctx, windowNo, BPtype, C_BPartner_ID, isCustomer, isVendor);// Add New Business Partner
            }
            if (resultMsg != string.Empty)
            {
                return(Json(JsonConvert.SerializeObject(resultMsg), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(JsonConvert.SerializeObject(VAdvantage.Utility.Msg.GetMsg((string)ViewBag.culture, "RecordSave")), JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult AddBPartnerInfo(int C_BPartner_ID, string searchKey, string name, string name2, string greeting, string bpGroup, string bpRelation, string bpLocation,
                                          string contact, string greeting1, string title, string email, string address, string phoneNo, string phoneNo2, string fax, int windowNo, string BPtype,
                                          bool isCustomer, bool isVendor, bool isProspect, string fileName, string mobile, string webUrl, bool isEmployee)
        {
            Ctx           ctx             = Session["ctx"] as Ctx;
            BPartnerModel objContactModel = new BPartnerModel();
            string        resultMsg       = string.Empty;
            string        fileUrl         = string.Empty;

            if (fileName != string.Empty)
            {
                if (!Directory.Exists(Path.Combine(Server.MapPath("~/Images"), "Temp")))
                {
                    Directory.CreateDirectory(Path.Combine(Server.MapPath("~/Images"), "Temp"));       //Create Thumbnail Folder if doesnot exists
                }

                fileUrl = Path.Combine(Server.MapPath("~/Images/Temp"), fileName);
            }
            if (C_BPartner_ID > 0)
            {
                resultMsg = objContactModel.AddBPartner(searchKey, name, name2, greeting, bpGroup, bpRelation, bpLocation, contact, greeting1, title, email, address, phoneNo, phoneNo2, fax, ctx, windowNo, BPtype, C_BPartner_ID, isCustomer, isVendor, isProspect, fileUrl, mobile, webUrl, isEmployee); // Update Business Partner
            }
            else
            {
                resultMsg = objContactModel.AddBPartner(searchKey, name, name2, greeting, bpGroup, bpRelation, bpLocation, contact, greeting1, title, email, address, phoneNo, phoneNo2, fax, ctx, windowNo, BPtype, C_BPartner_ID, isCustomer, isVendor, isProspect, fileUrl, mobile, webUrl, isEmployee);// Add New Business Partner
            }
            if (resultMsg != string.Empty)
            {
                return(Json(JsonConvert.SerializeObject(resultMsg), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(JsonConvert.SerializeObject(VAdvantage.Utility.Msg.GetMsg((string)ViewBag.culture, "RecordSaved")), JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult InitBP(int WinNo, int bPartnerID, string bpType)
        {
            ViewBag.WindowNumber = WinNo;
            Ctx           ctx        = Session["ctx"] as Ctx;
            BPartnerModel objBPModel = new BPartnerModel(WinNo, bPartnerID, bpType, ctx);

            return(Json(JsonConvert.SerializeObject(objBPModel), JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// Get Business Partner Location
        /// </summary>
        /// <param name="WinNo"></param>
        /// <param name="bpartnerID"></param>
        /// <returns></returns>
        public JsonResult GetBPLocation(int WinNo, int bpartnerID)
        {
            Ctx           ctx             = Session["ctx"] as Ctx;
            BPartnerModel objContactModel = new BPartnerModel();

            objContactModel.FillBPLocation(bpartnerID, ctx);
            return(Json(JsonConvert.SerializeObject(objContactModel), JsonRequestBehavior.AllowGet));
        }