Пример #1
0
        private void SaveData(int _idUser)
        {
            string strLink = "";

            try
            {
                int i     = 0;
                var gcdel = (from gp in db.NV_GIAONHANs
                             where gp.USER_ID == _idUser
                             select gp);

                db.NV_GIAONHANs.DeleteAllOnSubmit(gcdel);

                foreach (TreeListNode node in ASPxTreeList_menu.GetSelectedNodes())
                {
                    int _idmenu = Utils.CIntDef(node.Key, 0);
                    if (_idmenu > 0)
                    {
                        NV_GIAONHAN grinsert = new NV_GIAONHAN();
                        grinsert.USER_ID        = _idUser;
                        grinsert.USER_NAME      = GetUser(_idUser);
                        grinsert.PROP_PARENT_ID = Utils.CIntDef(ddlThanhPho.SelectedValue);
                        grinsert.PROP_ID        = _idmenu;
                        db.NV_GIAONHANs.InsertOnSubmit(grinsert);
                    }
                    i++;
                }
                for (int k = 0; k < chkOtherPos.Items.Count; k++)
                {
                    if (chkOtherPos.Items[k].Selected)
                    {
                        NV_GIAONHAN grinsert = new NV_GIAONHAN();
                        grinsert.USER_ID        = _idUser;
                        grinsert.USER_NAME      = GetUser(_idUser);
                        grinsert.PROP_PARENT_ID = Utils.CIntDef(ddlThanhPho.SelectedValue);
                        grinsert.PROP_ID_OTHER  = Utils.CIntDef(chkOtherPos.Items[k].Value);
                        db.NV_GIAONHANs.InsertOnSubmit(grinsert);
                    }
                }

                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }
Пример #2
0
 public virtual void Remove(int id)
 {
     try
     {
         NV_GIAONHAN b = this.GetById(id);
         this.Remove(b);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #3
0
 public virtual void Remove(NV_GIAONHAN b)
 {
     try
     {
         db.NV_GIAONHANs.DeleteOnSubmit(b);
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Пример #4
0
 public virtual void Create(NV_GIAONHAN cus)
 {
     try
     {
         this.db.NV_GIAONHANs.InsertOnSubmit(cus);
         db.SubmitChanges();
     }
     catch //(Exception e)
     {
         //throw new Exception(e.Message);
     }
 }
 public virtual void Remove(NV_GIAONHAN b)
 {
     try
     {
         db.NV_GIAONHANs.DeleteOnSubmit(b);
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
 public virtual void Create(NV_GIAONHAN cus)
 {
     try
     {
         this.db.NV_GIAONHANs.InsertOnSubmit(cus);
         db.SubmitChanges();
     }
     catch //(Exception e)
     {
         //throw new Exception(e.Message);
     }
 }
Пример #7
0
 public virtual void Update(NV_GIAONHAN cus)
 {
     try
     {
         NV_GIAONHAN cusOld = this.GetById(cus.ID);
         cusOld = cus;
         db.SubmitChanges();
     }
     catch //(Exception e)
     {
         //throw new Exception(e.Message);
     }
 }
 public virtual void Update(NV_GIAONHAN cus)
 {
     try
     {
         NV_GIAONHAN cusOld = this.GetById(cus.ID);
         cusOld = cus;
         db.SubmitChanges();
     }
     catch //(Exception e)
     {
         //throw new Exception(e.Message);
     }
 }
        private void SaveData(int _idUser)
        {
            string strLink = "";

            try
            {
                int i = 0;
                var gcdel = (from gp in db.NV_GIAONHANs
                             where gp.USER_ID == _idUser
                             select gp);

                db.NV_GIAONHANs.DeleteAllOnSubmit(gcdel);

                foreach (TreeListNode node in ASPxTreeList_menu.GetSelectedNodes())
                {
                    int _idmenu = Utils.CIntDef(node.Key, 0);
                    if (_idmenu > 0)
                    {
                        NV_GIAONHAN grinsert = new NV_GIAONHAN();
                        grinsert.USER_ID = _idUser;
                        grinsert.USER_NAME = GetUser(_idUser);
                        grinsert.PROP_PARENT_ID = Utils.CIntDef(ddlThanhPho.SelectedValue);
                        grinsert.PROP_ID = _idmenu;
                        db.NV_GIAONHANs.InsertOnSubmit(grinsert);
                    }
                    i++;
                }
                for (int k = 0; k < chkOtherPos.Items.Count; k++)
                {
                    if (chkOtherPos.Items[k].Selected)
                    {
                        NV_GIAONHAN grinsert = new NV_GIAONHAN();
                        grinsert.USER_ID = _idUser;
                        grinsert.USER_NAME = GetUser(_idUser);
                        grinsert.PROP_PARENT_ID = Utils.CIntDef(ddlThanhPho.SelectedValue);
                        grinsert.PROP_ID_OTHER = Utils.CIntDef(chkOtherPos.Items[k].Value);
                        db.NV_GIAONHANs.InsertOnSubmit(grinsert);
                    }
                }

                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                    Response.Redirect(strLink);
            }
        }