Exemplo n.º 1
0
        public ActionResult DetailsPost(StateDetailsVM objDetailsVM, string Submit)
        {
            CommonBL objCommonBL = null;

            try
            {
                if (Submit == "Save")
                {
                    objStateBL  = new StateBL();
                    objCommonBL = new CommonBL();
                    objDetailsVM.StateMstr.Status = 1;
                    objResponse         = objStateBL.SaveState(objDetailsVM.StateMstr, objDetailsVM.StateMstr.StateID > 0 ? "U" : "C");
                    objDetailsVM.CntMst = Chikitsa.DataAccessLayer.StateDAL.GetCountry();
                    // objDetailsVM.lstUserTypes = objCommonBL.GetCodeDetail(new CodeDetailFilter() { CodeTypeId = 1 });
                    objDetailsVM.Toast = WebCommon.SetToast(objResponse, "State", "Index");
                }
                return(View(objDetailsVM));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objStateBL   = null;
                objDetailsVM = null;
                objCommonBL  = null;
            }
        }
Exemplo n.º 2
0
        public ActionResult Action(StateMasterFilter objFilter, string submit)
        {
            CommonBL    objCommonBL = null;
            StateMaster objState    = null;

            try
            {
                objDetailsVM = new StateDetailsVM();
                if (submit.ToLower() == "edit")
                {
                    objCommonBL = new CommonBL();
                    TempData["CountryFilter"] = objFilter;
                    objStateBL             = new StateBL();
                    objDetailsVM           = new StateDetailsVM();
                    objDetailsVM.StateMstr = objStateBL.GetData(new StateMasterFilter()
                    {
                        StateID = objFilter.StateID
                    }).FirstOrDefault();
                    objDetailsVM.CntMst = Chikitsa.DataAccessLayer.StateDAL.GetCountry();
                    // objDetailsVM.lstUserTypes = objCommonBL.GetCodeDetail(new CodeDetailFilter() { CodeTypeId = 1 });
                    return(View("Details", objDetailsVM));
                }
                else if (submit.ToLower() == "delete")
                {
                    objStateBL          = new StateBL();
                    objListVM           = new StateMasterListVM();
                    objState            = new StateMaster(objFilter.StateID);
                    objState.ModifiedBy = 1;
                    objState.Remark     = "Deleted";
                    objResponse         = objStateBL.SaveState(objState, "D");
                    objFilter.CountryID = 0;
                    objListVM           = GetStateListVM(objFilter);
                    objListVM.Toast     = WebCommon.SetToast(objResponse);
                    return(View("Index", objListVM));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                objStateBL   = null;
                objDetailsVM = null;
                objListVM    = null;
                objCommonBL  = null;
            }
            return(null);
        }
Exemplo n.º 3
0
        protected void insertState()
        {
            Statetbl st = new Statetbl();

            st.StateName   = txtState.Text;
            st.CountryID   = Convert.ToInt32(DDlCountry.SelectedValue);
            st.IsActive    = 1;
            st.CreatedBy   = 1;
            st.CreatedDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            st.UpdatedBy   = 1;
            st.UpdatedDate = DateTime.Now.ToString();

            List <Statetbl> lst = new List <Statetbl>();

            lst = objStateBL.SaveState(st).ToList();
            if (lst[0].Message == "Success")
            {
                //ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alertMessage('State Saved Successfully');", true);
                ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alertMessage('State Saved Successfully');", true);
                //Response.Redirect("state.aspx");
            }
            Clear();
            GetState();
        }