Beispiel #1
0
        public ActionResult EditCustomerDetails()
        {
            if (Session["logindetails"] == null)
            {
                Session.Abandon();
                return(RedirectToAction("Index"));
            }
            try
            {
                USP_GetUserDetails_Result logindetails;
                //if (Session["logindetails"] != null)
                //{
                logindetails = (USP_GetUserDetails_Result)Session["logindetails"];
                usp_CustomerMasterGetbyID_Result customerdetails = new usp_CustomerMasterGetbyID_Result();
                TryUpdateModel(customerdetails);

                string result = (string)InventoryEntities.usp_CustomerMasterInsertUpdate(customerdetails.CustomerID, customerdetails.CustomerName, customerdetails.CustomerAddress, customerdetails.ContactPersonName, customerdetails.ContactNumber
                                                                                         , customerdetails.Email, logindetails.Branch_Id, logindetails.Company_Id, 0, logindetails.USer_Id, DateTime.Now, customerdetails.status, customerdetails.IsOwner).FirstOrDefault();
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index"));
            }
        }
Beispiel #2
0
        public ActionResult CreateCustomerDetails(FormCollection frm)
        {
            try {
                usp_CustomerMasterGetbyID_Result customerdetails = new usp_CustomerMasterGetbyID_Result();
                TryUpdateModel(customerdetails);
                USP_GetUserDetails_Result logindetails;
                //if (Session["logindetails"] != null)
                //{
                logindetails = (USP_GetUserDetails_Result)Session["logindetails"];
                // }
                string result = (string)InventoryEntities.usp_CustomerMasterInsertUpdate(0, customerdetails.CustomerName, customerdetails.CustomerAddress, customerdetails.ContactPersonName, customerdetails.ContactNumber
                                                                                         , customerdetails.Email, logindetails.Branch_Id, logindetails.Company_Id, logindetails.USer_Id, 0, DateTime.Now, customerdetails.status, customerdetails.IsOwner).FirstOrDefault();
                if (result == "Duplicate customer")
                {
                    ModelState.AddModelError("Error", "Customer already exists");

                    return(View());
                }

                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index"));
            }
        }
Beispiel #3
0
        public ActionResult EditCustomerDetails(int id)
        {
            if (Session["logindetails"] == null)
            {
                Session.Abandon();
                return(RedirectToAction("Index"));
            }
            // FillViewBag();
            usp_CustomerMasterGetbyID_Result customerdetails = InventoryEntities.usp_CustomerMasterGetbyID(id).FirstOrDefault();

            return(View(customerdetails));
        }