예제 #1
0
        protected void frmStateUpdate_ItemCommand(object sender, FormViewCommandEventArgs e)
        {
            #region Get Controls
            Guid    myCountryRow_Id   = Guid.Parse(Countryid);
            TextBox txtStateName      = (TextBox)frmStateUpdate.FindControl("txtStateName");
            TextBox txtStateCode      = (TextBox)frmStateUpdate.FindControl("txtStateCode");
            TextBox txtStateLocalName = (TextBox)frmStateUpdate.FindControl("txtLocalLanguage");

            #endregion

            if (e.CommandName.ToString() == "Save")
            {
                Guid myStateRow_Id = Guid.Parse(grdStateList.SelectedDataKey.Value.ToString());
                MDMSVC.DC_Master_State _objstateMaster = new DC_Master_State();
                _objstateMaster.State_Id   = myStateRow_Id;
                _objstateMaster.State_Name = txtStateName.Text.Trim();
                _objstateMaster.State_Code = txtStateCode.Text.Trim();
                _objstateMaster.StateName_LocalLanguage = txtStateLocalName.Text.Trim();
                _objstateMaster.Edit_User  = System.Web.HttpContext.Current.User.Identity.Name;
                _objstateMaster.Edit_Date  = DateTime.Now;
                _objstateMaster.Country_Id = Guid.Parse(Countryid);
                DC_Message _msg = new DC_Message();
                _msg = _objMaster.UpdateStatesMaster(_objstateMaster);
                if (_msg.StatusCode == MDMSVC.ReadOnlyMessageStatusCode.Success)
                {
                    frmStateUpdate.ChangeMode(FormViewMode.Insert);
                    frmStateUpdate.DataBind();
                    hdnFlagState.Value = "true";
                    BootstrapAlert.BootstrapAlertMessage(dvMsgState, "State Details has been updated successfully", BootstrapAlertType.Success);
                    fillgrdStateList(Guid.Parse(Countryid));
                }
                else
                {
                    BootstrapAlert.BootstrapAlertMessage(msgAlertState, _msg.StatusMessage, (BootstrapAlertType)_msg.StatusCode);
                }
            }
            else if (e.CommandName == "Add")
            {
                MDMSVC.DC_Master_State _objstateMaster = new DC_Master_State();
                _objstateMaster.State_Name = txtStateName.Text.Trim();
                _objstateMaster.State_Code = txtStateCode.Text.Trim();
                _objstateMaster.StateName_LocalLanguage = txtStateLocalName.Text.Trim();
                _objstateMaster.Create_User             = System.Web.HttpContext.Current.User.Identity.Name;
                _objstateMaster.Create_Date             = DateTime.Now;
                _objstateMaster.Country_Id = Guid.Parse(Countryid);
                DC_Message _msg = _objMaster.AddStatesMaster(_objstateMaster);
                if (_msg.StatusCode == ReadOnlyMessageStatusCode.Success)
                {
                    frmStateUpdate.ChangeMode(FormViewMode.Insert);
                    frmStateUpdate.DataBind();
                    hdnFlagState.Value = "true";
                    BootstrapAlert.BootstrapAlertMessage(dvMsgState, "State Details has been added successfully", BootstrapAlertType.Success);
                    fillgrdStateList(Guid.Parse(Countryid));
                }
                else
                {
                    BootstrapAlert.BootstrapAlertMessage(msgAlertState, _msg.StatusMessage, (BootstrapAlertType)_msg.StatusCode);
                }
            }
        }