コード例 #1
0
ファイル: PromotionSaleFlow.cs プロジェクト: SoftSuite/ABB
        public DataTable GetPDRequestList(PromotionSaleData data)
        {
            string whereString = "";

            if (data.WAREHOUSE != 0)
                whereString += (whereString == "" ? "" : "AND ") + "WAREHOUSE = '" + OracleDB.QRText(Convert.ToString(data.WAREHOUSE)) + "' ";
            if (data.ZONE != 0)
                whereString += (whereString == "" ? "" : "AND ") + "ZONE = '" + OracleDB.QRText(Convert.ToString(data.ZONE)) + "' ";
            if (data.EFDATEFROM.Year != 1)
                whereString += (whereString == "" ? "" : "AND ") + "EFDATE >= " + OracleDB.QRDate(data.EFDATEFROM) + " ";
            if (data.EFDATETO.Year != 1)
                whereString += (whereString == "" ? "" : "AND ") + "EFDATE <= " + OracleDB.QRDate(data.EFDATETO) + " ";
            if (data.EPDATEFROM.Year != 1)
                whereString += (whereString == "" ? "" : "AND ") + "EPDATE >= " + OracleDB.QRDate(data.EPDATEFROM) + " ";
            if (data.EPDATETO.Year != 1)
                whereString += (whereString == "" ? "" : "AND ") + "EPDATE <= " + OracleDB.QRDate(data.EPDATETO) + " ";

            string sql = "SELECT * ";
            sql += "FROM PROMOTION ";
            sql += (whereString == "" ? "" : "WHERE " + whereString);

            DataTable dt = OracleDB.ExecListCmd(sql);
            //for (int i = 0; i < dt.Rows.Count; ++i)
            //{
            //    dt.Rows[i]["NO"] = i + 1;
            //}
            return dt;
        }
コード例 #2
0
 private PromotionSaleData GetData()
 {
     PromotionSaleData data = new PromotionSaleData();
     data.WAREHOUSE = Convert.ToDouble(this.cmbWarehouse.SelectedItem.Value);
     //data.ZONE = Convert.ToDouble(this.cmbZone.SelectedItem.Value);
     data.EFDATEFROM = this.ctlEFDateFrom.DateValue;
     data.EFDATETO = this.ctlEFDateTo.DateValue;
     data.EPDATEFROM = this.ctlEPDateFrom.DateValue;
     data.EPDATETO = this.ctlEPDateTo.DateValue;
     return data;
 }
コード例 #3
0
ファイル: PromotionSales.aspx.cs プロジェクト: SoftSuite/ABB
 private PromotionSaleData GetData()
 {
     PromotionSaleData data = new PromotionSaleData();
     data.CODE = this.txtCode.Text.Trim();
     data.LOID = this.txtLOID.Text == "" ? 0 : Convert.ToDouble(this.txtLOID.Text);
     data.NAME = this.txtName.Text.Trim();
     data.CREATEON = this.ctlCreateOn.DateValue;
     data.WAREHOUSE = Convert.ToDouble(this.cmbWarehouse.SelectedItem.Value);
     data.ZONE = Convert.ToDouble(this.cmbZone.SelectedItem.Value);
     data.EFDATEFROM = this.ctlEFDate.DateValue;
     data.EPDATEFROM = this.ctlEPDate.DateValue;
     data.DISCOUNT = Convert.ToDouble(this.txtDISCOUNT.Text.Trim() == "" ? "0" : this.txtDISCOUNT.Text);
     data.LOWERPRICE = Convert.ToDouble(this.txtLowerPrice.Text.Trim() == "" ? "0" : this.txtLowerPrice.Text);
     data.ITEM = ItemObj.GetItemList();
     return data;
 }
コード例 #4
0
ファイル: PromotionSaleFlow.cs プロジェクト: SoftSuite/ABB
 public PromotionSaleData GetData(double loid)
 {
     PromotionSaleData data = new PromotionSaleData();
     if (DALObj.GetDataByLOID(loid, null))
     {
         data.EFDATEFROM = DALObj.EFDATE;
         data.EPDATEFROM = DALObj.EPDATE;
         data.CODE = DALObj.CODE;
         data.LOID = DALObj.LOID;
         data.NAME = DALObj.NAME;
         data.DISCOUNT = DALObj.DISCOUNT;
         data.WAREHOUSE = DALObj.WAREHOUSE;
         data.ZONE = DALObj.ZONE;
         data.CREATEON = DALObj.CREATEON;
         data.LOWERPRICE = DALObj.LOWERPRICE;
     }
     return data;
 }
コード例 #5
0
ファイル: PromotionSales.aspx.cs プロジェクト: SoftSuite/ABB
 private void SetData(PromotionSaleData data)
 {
     if (data.LOID == 0)
         data.CREATEON = DateTime.Today;
     this.txtLOID.Text = data.LOID.ToString();
     this.txtCode.Text = data.CODE.Trim();
     this.txtName.Text = data.NAME.Trim();
     this.cmbWarehouse.SelectedIndex = this.cmbWarehouse.Items.IndexOf(this.cmbWarehouse.Items.FindByValue(data.WAREHOUSE.ToString()));
     SetZoneCombo();
     //this.cmbZone.SelectedIndex = this.cmbZone.Items.IndexOf(this.cmbZone.Items.FindByValue(data.ZONE.ToString()));
     this.ctlCreateOn.DateValue = data.CREATEON;
     this.ctlEFDate.DateValue = data.EFDATEFROM.Date;
     this.ctlEPDate.DateValue = data.EPDATEFROM.Date;
     this.txtDISCOUNT.Text = data.DISCOUNT.ToString(Constz.IntFormat);
     this.txtLowerPrice.Text = data.LOWERPRICE.ToString(Constz.IntFormat);
     //add
     SetGrvItem();
 }
コード例 #6
0
ファイル: PromotionSaleFlow.cs プロジェクト: SoftSuite/ABB
        public bool NewPromotion(string userID, PromotionSaleData data)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                DALObj.NAME = data.NAME.Trim();
                DALObj.EFDATE = data.EFDATEFROM;
                DALObj.EFDATE = data.EFDATETO;
                DALObj.EPDATE = data.EPDATEFROM;
                DALObj.EPDATE = data.EPDATETO;
                DALObj.CODE = data.CODE.Trim();
                DALObj.DISCOUNT = Convert.ToDouble(data.DISCOUNT);
                DALObj.WAREHOUSE = Convert.ToDouble(data.WAREHOUSE);
                DALObj.ZONE = Convert.ToDouble(data.ZONE);
                DALObj.LOWERPRICE = data.LOWERPRICE;

                ret = DALObj.InsertCurrentData(userID, obj.zTrans);

                _LOID = DALObj.LOID;
                if (!ret)
                {
                    throw new ApplicationException(DALObj.ErrorMessage);
                }

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
コード例 #7
0
ファイル: PromotionSaleFlow.cs プロジェクト: SoftSuite/ABB
        public bool UpdateData(string userID, PromotionSaleData data)
        {
            bool ret = true;
            if (VeridateData(data))
            {

                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                    DALObj.NAME = data.NAME.Trim();
                    DALObj.EFDATE = data.EFDATEFROM;
                    DALObj.EPDATE = data.EPDATEFROM;
                    DALObj.CODE = data.CODE.Trim();
                    DALObj.DISCOUNT = Convert.ToDouble(data.DISCOUNT);
                    DALObj.WAREHOUSE = Convert.ToDouble(data.WAREHOUSE);
                    DALObj.ZONE = Convert.ToDouble(data.ZONE);
                    DALObj.LOWERPRICE = data.LOWERPRICE;

                    if (DALObj.OnDB)
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = DALObj.InsertCurrentData(userID, obj.zTrans);

                    _LOID = DALObj.LOID;
                    if (!ret)
                    {
                        throw new ApplicationException(DALObj.ErrorMessage);
                    }

                    ItemDALObj.DeleteDataByPromotion(data.LOID , obj.zTrans);
                    for (Int16 i = 0; i < data.ITEM.Count; ++i)
                    {
                        PromotionSalesItemData item = (PromotionSalesItemData)data.ITEM[i];
                        ItemDALObj.PRODUCT = Convert.ToDouble(item.PRODUCT);
                        ItemDALObj.PROMOTION = DALObj.LOID;
                        ItemDALObj.PRICENEW = Convert.ToDouble(item.PRICENEW);
                        ItemDALObj.PRICEOLD = Convert.ToDouble(item.PRICEOLD);
                        ItemDALObj.OnDB = false;
                        ret = ItemDALObj.InsertCurrentData(userID, obj.zTrans);
                        if (!ret) throw new ApplicationException(ItemDALObj.ErrorMessage);
                    }
                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else ret = false;
            return ret;
        }
コード例 #8
0
ファイル: PromotionSaleFlow.cs プロジェクト: SoftSuite/ABB
 private bool VeridateData(PromotionSaleData dal)
 {
     bool ret = true;
     if (dal.CODE.Trim() == "")
     {
         ret = false;
         _error = "¡ÃسÒÃкØÃËÑÊÊè§àÊÃÔÁ¡ÒâÒÂ";
     }
     else if (dal.NAME.Trim() == "")
     {
         ret = false;
         _error = "¡ÃسÒÃкت×èÍ¡ÒÃÊè§àÊÃÔÁ¡ÒâÒÂ";
     }
     else if (dal.WAREHOUSE == 0)
     {
         ret = false;
         _error = "¡ÃسÒàÅ×Í¡¤ÅѧÊÔ¹¤éÒ";
     }
     else if (dal.EFDATEFROM.Year == 1)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÇѹ·ÕèàÃÔèÁãªé";
     }
     else if (dal.EPDATEFROM.Year == 1)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÇѹ·ÕèÊÔé¹ÊØ´";
     }
     else if (dal.EFDATEFROM > dal.EPDATEFROM)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÇѹ·ÕèàÃÔèÁãªé áÅÐÇѹ·ÕèÊÔé¹ÊØ´ãËé¶Ù¡µéͧ";
     }
     else if (dal.DISCOUNT <=0)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÊèǹŴ";
     }
     else if (dal.ITEM.Count == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÃÒ¡ÒÃÊÔ¹¤éÒ·Õèµéͧ¡ÒÃÅ´ÃÒ¤Ò";
     }
     return ret;
 }