示例#1
0
        protected void gvKantorCabang_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            ActivityLog    log       = new ActivityLog();
            ActivityLogBll logBll    = new ActivityLogBll();
            string         host      = Request.UserHostName;
            string         ipaddress = Request.UserHostAddress;
            string         userName  = Session["user"].ToString();

            if (String.IsNullOrEmpty(ipaddress))
            {
                ipaddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
            }
            log.HostName  = host;
            log.IPAddress = ipaddress;
            log.Action    = "Delete";
            log.UserName  = userName;
            try
            {
                string id = e.Keys["branch_code"].ToString();

                Hashtable ht = new Hashtable();
                ht.Add("@ID-Int", id);
                ht.Add("@deleted_by-varchar-99", Session["user"]);
                bll.DeleteData(ht);
                log.Type        = "S";
                log.Description = log.Action + ' ' + id + ' ' + "Sukses oleh id" + ' ' + userName;
                e.Cancel        = true;
                gvKantorCabang.CancelEdit();
                GetData();
            }
            catch (Exception ex)
            {
                log.Type        = "E";
                log.Description = "Delete Error : " + ex.Message;
            }
            finally
            {
                logBll.InsertActivity(log);
            }
        }