示例#1
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string      un           = AspNetSecurityHelper.GetCurrentUserName;
            CityManager _CityManager = new CityManager();

            if (e.CommandName == "DeleteUpdate")
            {
                string Id = e.CommandArgument.ToString();
                int    id = 0;
                if (int.TryParse(Id, out id))
                {
                    bool chk = _CityManager.CheckCanDeleted(id);
                    if (chk)
                    {
                        string          operation = (String)GetGlobalResourceObject("HCMResource", "Delete");
                        int             i         = 0;//_CityManager.DeleteCity(id);
                        DAL.Entity.City obj       = _CityManager.GetCity(id);
                        if (obj != null)
                        {
                            obj.DeletedFlag     = true;
                            obj.LastUpdatedBy   = un;
                            obj.LastUpdatedDate = DateTime.Now;
                            i = _CityManager.UpdateCity(obj);
                        }
                        if (i != 0)
                        {
                            ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationSuccess"), operation), "", Common.msgType.alertMessageSuccess);
                        }
                        else
                        {
                            ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationError"), operation), "", Common.msgType.alertMessageDanger);
                        }
                    }
                    else
                    {
                        ucAlertMessage.AlertMessage((String)GetGlobalResourceObject("HCMResource", "CantDelete"), "", Common.msgType.alertMessageDanger);
                    }
                    FillData();
                }
            }
        }