Beispiel #1
0
 public virtual void Remove(ORDERMATERIAL user)
 {
     try
     {
         db.ORDERMATERIALs.DeleteOnSubmit(user);
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Beispiel #2
0
 public virtual int Delete(int id)
 {
     try
     {
         ORDERMATERIAL user = this.GetById(id);
         return(this.Delete(user));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Beispiel #3
0
 public virtual void Remove(int id)
 {
     try
     {
         ORDERMATERIAL user = this.GetById(id);
         this.Remove(user);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Beispiel #4
0
 public virtual void Create(ORDERMATERIAL user)
 {
     try
     {
         this.db.ORDERMATERIALs.InsertOnSubmit(user);
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Beispiel #5
0
 public virtual void Update(ORDERMATERIAL user)
 {
     try
     {
         ORDERMATERIAL userOld = this.GetById(user.ID);
         userOld = user;
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Beispiel #6
0
 public virtual int Delete(ORDERMATERIAL user)
 {
     try
     {
         //user.IsDelete = true;
         db.SubmitChanges();
         return(0);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
        private void Save(string strLink = "")
        {
            try
            {
                var orderMaterial = _OrderMaterialRepo.GetById(id);
                if (id > 0 && orderMaterial != null)
                {
                    orderMaterial.CODE         = txtCode.Text;
                    orderMaterial.ORDERPRICE   = Utils.CDecDef(txtOrderPrice.Text.Replace(",", ""));
                    orderMaterial.COMPANY_ID   = Utils.CIntDef(ddlCompany.SelectedValue);
                    orderMaterial.CREATED_DATE = pickerAndCalendarDate.returnDate;
                    orderMaterial.NOTE         = txtNote.Text;

                    orderMaterial.CREATOR_ID = Utils.CIntDef(Session["Userid"]);

                    _OrderMaterialRepo.Update(orderMaterial);

                    strLink = string.IsNullOrEmpty(strLink) ? "nhap-nguyen-lieu.aspx?id=" + id : strLink;
                }
                else
                {
                    orderMaterial              = new ORDERMATERIAL();
                    orderMaterial.CODE         = txtCode.Text;
                    orderMaterial.ORDERPRICE   = Utils.CDecDef(txtOrderPrice.Text.Replace(",", ""));
                    orderMaterial.COMPANY_ID   = Utils.CIntDef(ddlCompany.SelectedValue);
                    orderMaterial.CREATED_DATE = pickerAndCalendarDate.returnDate;
                    orderMaterial.NOTE         = txtNote.Text;
                    orderMaterial.TYPE         = Cost.NHAP_NGUYENLIEU;

                    orderMaterial.CREATOR_ID = Utils.CIntDef(Session["Userid"]);

                    _OrderMaterialRepo.Create(orderMaterial);

                    strLink = string.IsNullOrEmpty(strLink) ? "nhap-nguyen-lieu.aspx?id=" + orderMaterial.ID : strLink;
                }
            }
            catch
            {
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }