예제 #1
0
 public virtual void Remove(ORDER_DELI user)
 {
     try
     {
         db.ORDER_DELIs.DeleteOnSubmit(user);
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
예제 #2
0
 public virtual int Delete(int id)
 {
     try
     {
         ORDER_DELI user = this.GetById(id);
         return(this.Delete(user));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
예제 #3
0
 public virtual void Remove(int id)
 {
     try
     {
         ORDER_DELI user = this.GetById(id);
         this.Remove(user);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
예제 #4
0
 public virtual void Create(ORDER_DELI user)
 {
     try
     {
         this.db.ORDER_DELIs.InsertOnSubmit(user);
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
예제 #5
0
 public virtual void Update(ORDER_DELI user)
 {
     try
     {
         ORDER_DELI userOld = this.GetById(user.ID);
         userOld = user;
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
예제 #6
0
 public virtual int Delete(ORDER_DELI user)
 {
     try
     {
         //user.IsDelete = true;
         db.SubmitChanges();
         return(0);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
        private void Save(string strLink = "")
        {
            try
            {
                var orderDeli = _OrderDeliRepo.GetById(id);
                if (id > 0 && orderDeli != null)
                {
                    orderDeli.CODE              = txtCode.Text;
                    orderDeli.ORDER_ID          = Utils.CIntDef(ddlOrder.SelectedValue);
                    orderDeli.ORDER_DEADLINE_ID = Utils.CIntDef(ddlOrderDeadline.SelectedItem.Value);
                    orderDeli.CREATE_DATE       = pickerAndCalendarDeliDate.returnDate;
                    orderDeli.NOTE              = txtNote.Text;

                    orderDeli.CREATE_DATE = DateTime.Now;
                    orderDeli.CREATOR_ID  = Utils.CIntDef(Session["Userid"]);

                    _OrderDeliRepo.Update(orderDeli);

                    strLink = string.IsNullOrEmpty(strLink) ? "xuat-san-pham.aspx?id=" + id : strLink;
                }
                else
                {
                    orderDeli                   = new ORDER_DELI();
                    orderDeli.CODE              = txtCode.Text;
                    orderDeli.ORDER_ID          = Utils.CIntDef(ddlOrder.SelectedValue);
                    orderDeli.ORDER_DEADLINE_ID = Utils.CIntDef(ddlOrderDeadline.SelectedValue);
                    orderDeli.CREATE_DATE       = pickerAndCalendarDeliDate.returnDate;
                    orderDeli.NOTE              = txtNote.Text;

                    orderDeli.CREATE_DATE = DateTime.Now;
                    orderDeli.CREATOR_ID  = Utils.CIntDef(Session["Userid"]);

                    _OrderDeliRepo.Create(orderDeli);

                    strLink = string.IsNullOrEmpty(strLink) ? "xuat-san-pham.aspx?id=" + orderDeli.ID : strLink;
                }
            }
            catch
            {
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }