protected void grdZoneCities_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try {
         if (e.CommandName == "SoftDelete")
         {
             GridViewRow      row     = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
             int              index   = row.RowIndex;
             Guid             myRowId = Guid.Parse(e.CommandArgument.ToString());
             MDMSVC.DC_ZoneRQ RQ      = new MDMSVC.DC_ZoneRQ();
             RQ.Zone_id            = Zone_Id;
             RQ.ZoneCityMapping_Id = myRowId;
             RQ.Edit_Date          = DateTime.Now;
             RQ.Edit_User          = System.Web.HttpContext.Current.User.Identity.Name;
             RQ.Status             = "Inactive";
             RQ.IsActive           = false;
             var result = masterSVc.DeactivateOrActivateZones(RQ);
             fillgrdZoneCitiesData(Zone_Id);
         }
         if (e.CommandName == "UnDelete")
         {
             GridViewRow      row     = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
             int              index   = row.RowIndex;
             Guid             myRowId = Guid.Parse(e.CommandArgument.ToString());
             MDMSVC.DC_ZoneRQ p       = new MDMSVC.DC_ZoneRQ();
             p.Zone_id            = Zone_Id;
             p.ZoneCityMapping_Id = myRowId;
             p.Status             = "Active";
             p.IsActive           = true;
             p.Edit_Date          = DateTime.Now;
             p.Edit_User          = System.Web.HttpContext.Current.User.Identity.Name;
             var result = masterSVc.DeactivateOrActivateZones(p);
             fillgrdZoneCitiesData(Zone_Id);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#2
0
        protected void grdZoneSearch_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Select")
                {
                    GridViewRow row     = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
                    int         index   = row.RowIndex;
                    Guid        myRowId = Guid.Parse(e.CommandArgument.ToString());
                    //create Query String
                    string strQueryString = GetQueryString(myRowId.ToString(), ((GridView)sender).PageIndex.ToString());
                    Response.Redirect(strQueryString, true);
                    //end Query string
                }
                if (e.CommandName == "SoftDelete")
                {
                    GridViewRow      row     = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
                    int              index   = row.RowIndex;
                    Guid             myRowId = Guid.Parse(e.CommandArgument.ToString());
                    MDMSVC.DC_ZoneRQ RQ      = new MDMSVC.DC_ZoneRQ();
                    RQ.Zone_id   = myRowId;
                    RQ.Action    = "ZoneMaster";
                    RQ.Edit_Date = DateTime.Now;
                    RQ.Edit_User = System.Web.HttpContext.Current.User.Identity.Name;
                    RQ.Status    = "Inactive";
                    RQ.IsActive  = false;
                    var result = masterSVc.DeactivateOrActivateZones(RQ);
                    if (result != null)
                    {
                        if (result.StatusCode == MDMSVC.ReadOnlyMessageStatusCode.Success)
                        {
                            fillMasterSearchData(0, Convert.ToInt32(ddlShowEntries.SelectedValue));
                            BootstrapAlert.BootstrapAlertMessage(dvMsgDeleted, "Zone has been deleted successfully", BootstrapAlertType.Success);
                        }

                        else
                        {
                            BootstrapAlert.BootstrapAlertMessage(dvMsgDeleted, result.StatusMessage, (BootstrapAlertType)result.StatusCode);
                        }
                    }
                }
                if (e.CommandName == "UnDelete")
                {
                    GridViewRow      row     = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
                    int              index   = row.RowIndex;
                    Guid             myRowId = Guid.Parse(e.CommandArgument.ToString());
                    MDMSVC.DC_ZoneRQ p       = new MDMSVC.DC_ZoneRQ();
                    p.Zone_id   = myRowId;
                    p.Action    = "ZoneMaster";
                    p.Status    = "Active";
                    p.IsActive  = true;
                    p.Edit_Date = DateTime.Now;
                    p.Edit_User = System.Web.HttpContext.Current.User.Identity.Name;
                    var result = masterSVc.DeactivateOrActivateZones(p);
                    if (result != null)
                    {
                        if (result.StatusCode == MDMSVC.ReadOnlyMessageStatusCode.Success)
                        {
                            fillMasterSearchData(0, Convert.ToInt32(ddlShowEntries.SelectedValue));
                            BootstrapAlert.BootstrapAlertMessage(dvMsgDeleted, "Zone has been Undeleted successfully", BootstrapAlertType.Success);
                        }

                        else
                        {
                            BootstrapAlert.BootstrapAlertMessage(dvMsgDeleted, result.StatusMessage, (BootstrapAlertType)result.StatusCode);
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }