예제 #1
0
    public bool UpdatePromotionItem(decimal LOID, string BARCODE, string NAME, string UNAME, decimal PRICEOLD, decimal PRICENEW, decimal PRODUCT, decimal RANK)
    {
        PromotionSalesItemData data = new PromotionSalesItemData();
        data.LOID = Convert.ToDouble(LOID);
        data.BARCODE = Convert.ToString(BARCODE);
        data.NAME = Convert.ToString(NAME);
        data.UNAME = Convert.ToString(UNAME);
        data.PRICEOLD = Convert.ToDouble(PRICEOLD);
        data.PRICENEW = Convert.ToDouble(PRICENEW);
        data.PRODUCT = Convert.ToDouble(PRODUCT);

        bool ret = true;
        ret = VerifyData(data);
        if (ret)
        {
            DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
            if (dt != null)
            {
                DataRow[] dRows = dt.Select("LOID = " + data.LOID.ToString());
                DataRow dRow = dRows[0];
                dRow["NAME"] = data.NAME;
                dRow["UNAME"] = data.UNAME;
                PromotionSaleData product = FlowObj.GetPromotionData(data.LOID);
                //data.PRICE = product.PRICE;
                dRow["BARCODE"] = data.BARCODE;
                dRow["PRICENEW"] = data.PRICENEW;
                dRow["PRICEOLD"] = data.PRICEOLD;
                dRow["PRODUCT"] = data.PRODUCT;
                ReOrder(dt);
                System.Web.HttpContext.Current.Session[sessionName] = dt;
            }
        }
        else throw new ApplicationException(_error);
        return ret;
    }
예제 #2
0
 //0 LOID, 0 PRODUCT, 0 QTY, 0 UNIT, 0 PRICE, 0 DISCOUNT, 0 NETPRICE, '" + Constz.ActiveStatus.Active + "' ACTIVE, '' BARCODE, '' UNITNAME, '' ISVAT ";
 public bool InsertPromotionSalesItem(PromotionSalesItemData data)
 {
     bool ret = true;
     ret = VerifyData(data);
     if (ret)
     {
         DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
         if (dt != null)
         {
             ReOrder(dt);
             DataRow dRow = dt.NewRow();
             dRow["LOID"] = Convert.ToDouble(dt.Rows.Count) + 1;
             dRow["RANK"] = Convert.ToDouble(dRow["LOID"]);
             dRow["NAME"] = data.NAME;
             PromotionSaleData Promotion = FlowObj.GetPromotionData(data.LOID);
             dRow["PRICENEW"] = data.PRICENEW;
             dRow["PRICEOLD"] = data.PRICEOLD;
             dRow["BARCODE"] = data.BARCODE;
             dRow["UNAME"] = data.UNAME;
             dRow["BARCODE"] = data.BARCODE;
             dRow["PROMOTION"] = data.PROMOTION;
             dRow["PRODUCT"] = data.PRODUCT;
             dt.Rows.Add(dRow);
             System.Web.HttpContext.Current.Session[sessionName] = dt;
         }
     }
     return ret;
 }
예제 #3
0
 public ArrayList GetItemList()
 {
     DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
     ArrayList arr = new ArrayList();
     if (dt != null)
     {
         foreach (DataRow dRow in dt.Rows)
         {
             PromotionSalesItemData data = new PromotionSalesItemData();
             data.LOID = Convert.ToDouble(dRow["LOID"]);
             data.NAME = Convert.ToString(dRow["NAME"]);
             data.PRICENEW = Convert.ToDouble(dRow["PRICENEW"]);
             data.PRICEOLD = Convert.ToDouble(dRow["PRICEOLD"]);
             data.UNAME = Convert.ToString(dRow["UNAME"]);
             data.PRODUCT = Convert.ToDouble(dRow["PRODUCT"]);
             data.PROMOTION = Convert.ToDouble(dRow["PROMOTION"]);
             arr.Add(data);
         }
     }
     return arr;
 }
예제 #4
0
 public PromotionSalesItemData GetDataPromotion(double loid)
 {
     PromotionSalesItemData data = new PromotionSalesItemData();
     if (SearchDAL.GetDataByLOID(loid, null))
     {
         data.PRICENEW = Convert.ToDouble(SearchDAL.PRICENEW);
         data.PRICEOLD = Convert.ToDouble(SearchDAL.PRICEOLD);
         data.PROMOTION = Convert.ToDouble(SearchDAL.PROMOTION);
         data.PRODUCT = Convert.ToDouble(SearchDAL.PRODUCT);
         //data.CODE = DALObj1.CODE;
         data.LOID = SearchDAL.LOID;
         data.NAME = SearchDAL.NAME;
         data.UNAME = SearchDAL.UNAME;
         data.BARCODE = SearchDAL.BARCODE;
         data.CREATEON = SearchDAL.CREATEON;
     }
     return data;
 }
예제 #5
0
 private bool VerifyData(PromotionSalesItemData data)
 {
     bool ret = true;
     if (data.PRODUCT == 0)
     {
         ret = false;
         _error = "¡ÃسÒàÅ×Í¡ÊÔ¹¤éÒ";
     }
     //else if (data.PRICENEW == 0 || data.PRICENEW == data.PRICEOLD)
     //{
     //    ret = false;
     //    _error = "¡ÃسÒÃкØÊèǹŴ";
     //}
     else
     {
         DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
         foreach (DataRow dRow in dt.Rows)
         {
             if (Convert.ToDouble(dRow["PRODUCT"]) == data.PRODUCT && Convert.ToDouble(dRow["LOID"]) != data.LOID)
             {
                 _error = "ÃÒ¡ÒÃÊÔ¹¤éÒ¹ÕéÁÕÍÂÙèã¹ÃÒ¡ÒÃáÅéÇ";
                 ret = false;
                 goto ex;
             }
         }
     ex: ;
     }
     return ret;
 }
예제 #6
0
    public bool UpdatePromotionSaleItem(decimal LOID, string BARCODE, string NAME, string UNAME, decimal PRICEOLD, decimal PRICENEW, decimal RANK)
    {
        PromotionSalesItemData data = new PromotionSalesItemData();
        data.LOID = Convert.ToDouble(LOID);
        //data.DISCOUNT = Convert.ToDouble(DISCOUNT);
        //data.NETPRICE = Convert.ToDouble(NETPRICE);
        //data.PRICE = Convert.ToDouble(PRICE);
        data.PRICENEW = Convert.ToDouble(PRICENEW);
        data.PRICEOLD = Convert.ToDouble(PRICEOLD);
        data.UNAME = UNAME;
        data.NAME = NAME;

        bool ret = true;
        ret = VerifyData(data);
        if (ret)
        {
            DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
            if (dt != null)
            {
                DataRow[] dRows = dt.Select("LOID = " + data.LOID.ToString());
                DataRow dRow = dRows[0];
                dRow["NAME"] = data.NAME;
                dRow["UNAME"] = data.UNAME;
                PromotionSaleData Promotion = FlowObj.GetPromotionData(data.LOID);
                //data.PRICE = product.PRICE;
                //dRow["PRICE"] = data.PRICE;
                //dRow["DISCOUNT"] = data.DISCOUNT;
                //dRow["NETPRICE"] = Convert.ToDouble((data.QUANTITY * data.PRICE) - data.DISCOUNT);
                dRow["BARCODE"] = data.BARCODE;
                //dRow["UNIT"] = FlowObj.GetUnitData(data.UNIT).NAME;
                dRow["PRICENEW"] = data.PRICENEW;
                //dRow["ISVAT"] = product.ISVAT;
                ReOrder(dt);
                System.Web.HttpContext.Current.Session[sessionName] = dt;
            }
        }
        else throw new ApplicationException(_error);
        return ret;
    }
예제 #7
0
 public bool CopyPromotion(string userID, double loidSource)
 {
     PromotionSaleData data = GetData(loidSource);
     DataTable itemList = GetPromotionItem(data.LOID);
     ArrayList arr = new ArrayList();
     foreach (DataRow dRow in itemList.Rows)
     {
         PromotionSalesItemData idata = new PromotionSalesItemData();
         idata.LOID = data.LOID;
         idata.BARCODE = Convert.ToString(dRow["BARCODE"]);
         idata.NAME = Convert.ToString(dRow["NAME"]);
         idata.PRICENEW = Convert.ToDouble(dRow["PRICENEW"]);
         idata.PRICEOLD = Convert.ToDouble(dRow["PRICEOLD"]);
         idata.UNAME = Convert.ToString(dRow["UNAME"]);
         arr.Add(idata);
     }
     //data.ITEM = arr;
     DALObj.OnDB = false;
     data.LOID = 0;
     return UpdateData(userID, data);
 }
예제 #8
0
 public ArrayList GetItemList()
 {
     DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
     ArrayList arr = new ArrayList();
     if (dt != null)
     {
         foreach (DataRow dRow in dt.Rows)
         {
             PromotionSalesItemData data = new PromotionSalesItemData();
             //data.ACTIVE = Constz.ActiveStatus.Active;
             //data.DISCOUNT = Convert.ToDouble(dRow["DISCOUNT"]);
             data.LOID = Convert.ToDouble(dRow["LOID"]);
             //data.NETPRICE = Convert.ToDouble(dRow["NETPRICE"]);
             //data.PRICE = Convert.ToDouble(dRow["PRICE"]);
             data.NAME = Convert.ToString(dRow["NAME"]);
             data.PRICENEW = Convert.ToDouble(dRow["PRICENEW"]);
             data.PRICEOLD = Convert.ToDouble(dRow["PRICEOLD"]);
             data.UNAME = Convert.ToString(dRow["UNAME"]);
             arr.Add(data);
         }
     }
     return arr;
 }
예제 #9
0
 //0 LOID, 0 PRODUCT, 0 QTY, 0 UNIT, 0 PRICE, 0 DISCOUNT, 0 NETPRICE, '" + Constz.ActiveStatus.Active + "' ACTIVE, '' BARCODE, '' UNITNAME, '' ISVAT ";
 public bool InsertPromotionSalesItem(PromotionSalesItemData data)
 {
     bool ret = true;
     ret = VerifyData(data);
     if (ret)
     {
         DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
         if (dt != null)
         {
             ReOrder(dt);
             DataRow dRow = dt.NewRow();
             dRow["LOID"] = Convert.ToDouble(dt.Rows.Count) + 1;
             dRow["RANK"] = Convert.ToDouble(dRow["LOID"]);
             dRow["NAME"] = data.NAME;
             PromotionSaleData Promotion = FlowObj.GetPromotionData(data.LOID);
             //data.PRICE = product.PRICE;
             dRow["PRICENEW"] = data.PRICENEW;
             dRow["PRICEOLD"] = data.PRICEOLD;
             //dRow["PRICE"] = Convert.ToDouble(data.PRICE);
             //dRow["DISCOUNT"] = Convert.ToDouble(data.DISCOUNT);
             //dRow["NETPRICE"] = Convert.ToDouble((data.QUANTITY * data.PRICE) - data.DISCOUNT);
             //dRow["ACTIVE"] = Constz.ActiveStatus.Active;
             dRow["BARCODE"] = data.BARCODE;
             //dRow["UNIT"] = FlowObj.GetUnitData(data.UNIT).NAME;
             //dRow["ISVAT"] = product.ISVAT;
             dRow["UNAME"] = data.UNAME;
             dt.Rows.Add(dRow);
             System.Web.HttpContext.Current.Session[sessionName] = dt;
         }
     }
     return ret;
 }
예제 #10
0
 private bool VerifyData(PromotionSalesItemData data)
 {
     bool ret = true;
     if (data.NAME == "")
     {
         ret = false;
         _error = "¡ÃسÒàÅ×Í¡ÊÔ¹¤éÒ";
     }
     else if (data.UNAME == "")
     {
         ret = false;
         _error = "¡ÃسÒÃкØ˹èÇÂ";
     }
     else
     {
         DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
         foreach (DataRow dRow in dt.Rows)
         {
             if (Convert.ToString(dRow["NAME"]) == data.NAME && Convert.ToDouble(dRow["LOID"]) != data.LOID)
             {
                 _error = "ÃÒ¡ÒÃÊÔ¹¤éÒ¹ÕéÁÕÍÂÙèã¹ÃÒ¡ÒÃáÅéÇ";
                 ret = false;
                 goto ex;
             }
         }
     ex: ;
     }
     return ret;
 }
예제 #11
0
    protected void grvItem_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox txtBarcode = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[2].FindControl("txtBarcode");
        DropDownList cmbProduct = (DropDownList)this.grvItem.Rows[e.RowIndex].Cells[3].FindControl("cmbProduct");
        TextBox txtUnit = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[4].FindControl("txtUnit");
        TextBox txtOldPrice = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[5].FindControl("txtOldPrice");
        TextBox txtNewPrice = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[6].FindControl("txtNewPrice");
        PromotionSalesItemData data = new PromotionSalesItemData();
        data.PRODUCT = Convert.ToDouble(cmbProduct.SelectedItem.Value);
        data.NAME = Convert.ToString(cmbProduct.SelectedItem.Text);
        data.UNAME = Convert.ToString(txtUnit.Text);
        data.BARCODE = txtBarcode.Text.Trim();
        data.PRICEOLD = Convert.ToDouble(txtOldPrice.Text == "" ? "0" : txtOldPrice.Text);
        data.PRICENEW = Convert.ToDouble(txtNewPrice.Text == "" ? "0" : txtNewPrice.Text);

        e.NewValues["PRODUCT"] = data.PRODUCT;
        e.NewValues["NAME"] = data.NAME.ToString();
        e.NewValues["PRICEOLD"] = data.PRICEOLD;
        e.NewValues["UNAME"] = data.UNAME.ToString();
        e.NewValues["PRICENEW"] = data.PRICENEW;
        e.NewValues["BARCODE"] = data.BARCODE.ToString(); 
    }
예제 #12
0
    private void InsertData(GridViewRow gRow)
    {
        TextBox txtCode = (TextBox)gRow.Cells[2].FindControl("txtNewBarCode");
        DropDownList cmbProduct = (DropDownList)gRow.Cells[3].FindControl("cmbNewProduct");
        TextBox txtUnit = (TextBox)gRow.Cells[4].FindControl("txtNewUnit");
        TextBox txtOldPrice = (TextBox)gRow.Cells[5].FindControl("txtNewOldPrice");
        TextBox txtNewPrice = (TextBox)gRow.Cells[6].FindControl("txtNewNewPrice");

        PromotionSalesItemData data = new PromotionSalesItemData();
        data.NAME = Convert.ToString(cmbProduct.SelectedItem.Text);
        data.UNAME = Convert.ToString(txtUnit.Text);
        data.PRICEOLD = Convert.ToDouble(txtOldPrice.Text == "" ? "0" : txtOldPrice.Text);
        data.PRODUCT = Convert.ToDouble(cmbProduct.SelectedItem.Value);
        data.PRICENEW = Convert.ToDouble(txtNewPrice.Text == "" ? "0" : txtNewPrice.Text);
        data.BARCODE = txtCode.Text;

        if (ItemObj.InsertPromotionSalesItem(data))
        {
            SetGrvItem();
        }
        else
            Appz.ClientAlert(this, ItemObj.ErrorMessage);
    }