示例#1
0
        private void simpleButton1_Click(object sender, System.EventArgs e)
        {
            bool isSave  = false;
            bool isError = false;

            DevExpress.XtraGrid.Columns.GridColumn col1 = gridView1.Columns.ColumnByFieldName("strItemCode");
            DevExpress.XtraGrid.Columns.GridColumn col2 = gridView1.Columns.ColumnByFieldName("strPromotionCode");
            DevExpress.XtraGrid.Columns.GridColumn col3 = gridView1.Columns.ColumnByFieldName("OutStock");

            SqlConnection sqlcon = new SqlConnection(SqlHelperUtils.connectionString);

            sqlcon.Open();

            SqlTransaction tran = sqlcon.BeginTransaction();

            ACMSLogic.Promotion.Promotion promotion = new ACMSLogic.Promotion.Promotion();
            //promotion.DeleteAdjustmentPromotion(tran,this.textEdit2.Text,this.textEdit1.Text);

            for (int i = 0; i < this.gridView1.DataRowCount; i++)
            {
                object cellValue1 = gridView1.GetRowCellValue(i, col1);
                object cellValue3 = gridView1.GetRowCellValue(i, col3);

                if (cellValue3 != null)
                {
                    if (Convert.ToBoolean(cellValue3.ToString()))
                    {
                        if (promotion.UpdateAdjustmentPromotion(tran, this.textEdit2.Text, cellValue1.ToString(), this.textEdit1.Text, strBranchCode, Convert.ToInt32(nEntryID), panel))
                        {
                            isSave = true;
                        }
                        else
                        {
                            isError = false;
                        }
                    }
                }
            }

            if (isError)
            {
                Utils.UI.ShowMessage(this, "Some of the record cannot be saved into database. Please contact System Administrator!");
            }
            else
            {
                if (isSave)
                {
                    Utils.UI.ShowMessage(this, "Record Has Been Updated");
                }

                tran.Commit();
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
示例#2
0
        private void BindPage(string type, string strPromotionCode, string strBranchCode, string strReceiptNo)
        {
            this.textEdit2.Enabled = false;
            this.textEdit1.Enabled = false;
            simpleButton1.Enabled  = true;
            this.textEdit1.Text    = strPromotionCode;
            this.textEdit2.Text    = strReceiptNo;

            DataSet ds = null;

            ACMSLogic.Promotion.Promotion promotion = new ACMSLogic.Promotion.Promotion();
            ds = promotion.FindPromotionByPromotionCode(strPromotionCode, strBranchCode, strReceiptNo, type, panel);


            if (ds != null)
            {
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (type == "View")
                        {
                            foreach (DataRow dr in ds.Tables[0].Rows)
                            {
                                dr["OutStock"] = true;
                            }
                            this.gridView1.OptionsBehavior.Editable = false;
                        }
                        this.simpleButton1.Enabled   = false;
                        this.gridControl1.DataSource = ds.Tables[0];
                    }
                    else
                    {
                        this.simpleButton1.Enabled = false;
                    }
                }
                else
                {
                    UI.ShowErrorMessage(this, "No record(s) found", "Error");
                }
            }



//
//			DevExpress.XtraGrid.Columns.GridColumn col3 = gridView1.Columns.ColumnByFieldName("OutStock");
//
//
//			for(int i=0;i<this.gridView1.DataRowCount;i++)
//			{
//				this.gridView1.g
//			}
        }
示例#3
0
        public void BindData(string strBranchCode)
        {
            DataSet ds = null;
            ACMSLogic.Promotion.Promotion promotion  = new ACMSLogic.Promotion.Promotion();
            ds = promotion.FindPromotionByBranch(strBranchCode);
            if(ds!=null)
            {
                if(ds.Tables.Count>0)
                {
                    this.lookUpEdit1.Properties.DataSource = ds.Tables[0];
                    this.lookUpEdit1.Properties.ValueMember = "strPromotionCode";
                    this.lookUpEdit1.Properties.DisplayMember = "strPromotionCode";
                    this.lookUpEdit1.Properties.BestFit();
                    this.lookUpEdit1.Properties.PopupWidth = 350;

                }
            }
        }
示例#4
0
        public void BindData(string strBranchCode)
        {
            DataSet ds = null;

            ACMSLogic.Promotion.Promotion promotion = new ACMSLogic.Promotion.Promotion();
            ds = promotion.FindPromotionByBranch(strBranchCode);
            if (ds != null)
            {
                if (ds.Tables.Count > 0)
                {
                    this.lookUpEdit1.Properties.DataSource    = ds.Tables[0];
                    this.lookUpEdit1.Properties.ValueMember   = "strPromotionCode";
                    this.lookUpEdit1.Properties.DisplayMember = "strPromotionCode";
                    this.lookUpEdit1.Properties.BestFit();
                    this.lookUpEdit1.Properties.PopupWidth = 350;
                }
            }
        }
        private void simpleButton1_Click(object sender, System.EventArgs e)
        {
            bool isSave = false;
            bool isError = false;
            DevExpress.XtraGrid.Columns.GridColumn col1 = gridView1.Columns.ColumnByFieldName("strProductCode");
            DevExpress.XtraGrid.Columns.GridColumn col2 = gridView1.Columns.ColumnByFieldName("strDescription");
            DevExpress.XtraGrid.Columns.GridColumn col3 = gridView1.Columns.ColumnByFieldName("OutStock");

            SqlConnection sqlcon = new SqlConnection(SqlHelperUtils.connectionString);
            sqlcon.Open();

            SqlTransaction tran = sqlcon.BeginTransaction();

            ACMSLogic.Promotion.Promotion promotion = new ACMSLogic.Promotion.Promotion();
            //promotion.DeleteAdjustmentPromotion(tran,this.textEdit2.Text,this.textEdit1.Text);

            for (int i = 0; i < this.gridView1.DataRowCount; i++)
            {
                object cellValue1 = gridView1.GetRowCellValue(i, col1);
                object cellValue3 = gridView1.GetRowCellValue(i, col3);

                if (cellValue3 != null)
                {
                    if (Convert.ToBoolean(cellValue3.ToString()))
                    {
                        DataSet dsQty = new DataSet();
                        string strSQL = "select (ISNULL((select nMaxQty from tblPromotionFreebie where strPromotionCode ='" + this.lkpEdtItemFreebiePromotionCode.EditValue.ToString() + "' and strItemCode='" + cellValue1.ToString() + "'),0) - ISNULL((select COUNT(*) from tblReceiptFreebie WITH (NOLOCK) where strReceiptNo ='" + strReceiptNo + "' and strItemCode='" + cellValue1.ToString() + "' group by strReceiptNo),0)) as nQty ";

                        SqlHelper.FillDataset(tran, CommandType.StoredProcedure, "UP_GETDATA", dsQty, new string[] { "Table" }, new SqlParameter("@strSQL", strSQL));
                        DataTable dtQty = dsQty.Tables["Table"];

                        if (Convert.ToInt16(dtQty.Rows[0]["nQty"]) > 0)
                        {
                            if (promotion.UpdateAdjustmentPromotion(tran, strReceiptNo, cellValue1.ToString(), this.lkpEdtItemFreebiePromotionCode.EditValue.ToString(), strBranchCode, Convert.ToInt32(nEntryID), panel))
                            {
                                isSave = true;
                            }
                            else
                            {
                                isError = false;
                            }
                        }
                        else
                            Utils.UI.ShowMessage(this, "Out stock qty exceed maximum qty allowed!");

                        dtQty.Dispose();
                        dsQty.Dispose();
                    }
                }
            }

            if (isError)
            {
                Utils.UI.ShowMessage(this, "Some of the record cannot be saved into database. Please contact System Administrator!");
            }
            else
            {
                if (isSave)
                    Utils.UI.ShowMessage(this, "Record Has Been Updated");

                tran.Commit();
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        private void simpleButton1_Click(object sender, System.EventArgs e)
        {
            bool isSave=false;
            bool isError=false;
            DevExpress.XtraGrid.Columns.GridColumn col1 = gridView1.Columns.ColumnByFieldName("strProductCode");
            DevExpress.XtraGrid.Columns.GridColumn col2 = gridView1.Columns.ColumnByFieldName("strDescription");
            DevExpress.XtraGrid.Columns.GridColumn col3 = gridView1.Columns.ColumnByFieldName("OutStock");

            SqlConnection sqlcon = new SqlConnection(SqlHelperUtils.connectionString);
            sqlcon.Open();

            SqlTransaction tran = sqlcon.BeginTransaction();

            ACMSLogic.Promotion.Promotion promotion = new ACMSLogic.Promotion.Promotion();
            //promotion.DeleteAdjustmentPromotion(tran,this.textEdit2.Text,this.textEdit1.Text);

            for(int i=0;i<this.gridView1.DataRowCount;i++)
            {
                object cellValue1 = gridView1.GetRowCellValue(i, col1);
                object cellValue3 = gridView1.GetRowCellValue(i, col3);

                if(cellValue3!=null)
                {
                    if(Convert.ToBoolean(cellValue3.ToString()))
                    {

                        if(promotion.UpdateAdjustmentPromotion(tran,strReceiptNo,cellValue1.ToString(),this.lkpEdtItemFreebiePromotionCode.EditValue.ToString(),strBranchCode,Convert.ToInt32(nEntryID),panel))
                        {
                            isSave=true;
                        }
                        else
                        {
                            isError=false;
                        }

                    }
                }
            }

            if(isError)
            {
                Utils.UI.ShowMessage(this,"Some of the record cannot be saved into database. Please contact System Administrator!");
            }
            else
            {
                if(isSave)
                    Utils.UI.ShowMessage(this,"Record Has Been Updated");

                tran.Commit();
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        private void simpleButton1_Click(object sender, System.EventArgs e)
        {
            bool isSave  = false;
            bool isError = false;

            DevExpress.XtraGrid.Columns.GridColumn col1 = gridView1.Columns.ColumnByFieldName("strProductCode");
            DevExpress.XtraGrid.Columns.GridColumn col2 = gridView1.Columns.ColumnByFieldName("strDescription");
            DevExpress.XtraGrid.Columns.GridColumn col3 = gridView1.Columns.ColumnByFieldName("OutStock");

            SqlConnection sqlcon = new SqlConnection(SqlHelperUtils.connectionString);

            sqlcon.Open();

            SqlTransaction tran = sqlcon.BeginTransaction();

            ACMSLogic.Promotion.Promotion promotion = new ACMSLogic.Promotion.Promotion();
            //promotion.DeleteAdjustmentPromotion(tran,this.textEdit2.Text,this.textEdit1.Text);

            for (int i = 0; i < this.gridView1.DataRowCount; i++)
            {
                object cellValue1 = gridView1.GetRowCellValue(i, col1);
                object cellValue3 = gridView1.GetRowCellValue(i, col3);

                if (cellValue3 != null)
                {
                    if (Convert.ToBoolean(cellValue3.ToString()))
                    {
                        DataSet dsQty  = new DataSet();
                        string  strSQL = "select (ISNULL((select nMaxQty from tblPromotionFreebie where strPromotionCode ='" + this.lkpEdtItemFreebiePromotionCode.EditValue.ToString() + "' and strItemCode='" + cellValue1.ToString() + "'),0) - ISNULL((select COUNT(*) from tblReceiptFreebie WITH (NOLOCK) where strReceiptNo ='" + strReceiptNo + "' and strItemCode='" + cellValue1.ToString() + "' group by strReceiptNo),0)) as nQty ";

                        SqlHelper.FillDataset(tran, CommandType.StoredProcedure, "UP_GETDATA", dsQty, new string[] { "Table" }, new SqlParameter("@strSQL", strSQL));
                        DataTable dtQty = dsQty.Tables["Table"];

                        if (Convert.ToInt16(dtQty.Rows[0]["nQty"]) > 0)
                        {
                            if (promotion.UpdateAdjustmentPromotion(tran, strReceiptNo, cellValue1.ToString(), this.lkpEdtItemFreebiePromotionCode.EditValue.ToString(), strBranchCode, Convert.ToInt32(nEntryID), panel))
                            {
                                isSave = true;
                            }
                            else
                            {
                                isError = false;
                            }
                        }
                        else
                        {
                            Utils.UI.ShowMessage(this, "Out stock qty exceed maximum qty allowed!");
                        }

                        dtQty.Dispose();
                        dsQty.Dispose();
                    }
                }
            }

            if (isError)
            {
                Utils.UI.ShowMessage(this, "Some of the record cannot be saved into database. Please contact System Administrator!");
            }
            else
            {
                if (isSave)
                {
                    Utils.UI.ShowMessage(this, "Record Has Been Updated");
                }

                tran.Commit();
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        private void BindPage(string type,string strPromotionCode,string strBranchCode,string strReceiptNo)
        {
            this.textEdit2.Enabled=false;
            this.textEdit1.Enabled=false;
            simpleButton1.Enabled=true;
            this.textEdit1.Text=strPromotionCode;
            this.textEdit2.Text=strReceiptNo;

            DataSet ds = null;
            ACMSLogic.Promotion.Promotion promotion = new ACMSLogic.Promotion.Promotion();
            ds = promotion.FindPromotionByPromotionCode(strPromotionCode,strBranchCode,strReceiptNo,type,panel);

            if(ds!=null)
            {
                if(ds.Tables.Count>0)
                {
                    if(ds.Tables[0].Rows.Count>0)
                    {
                        if(type=="View")
                        {
                            foreach(DataRow dr in ds.Tables[0].Rows)
                            {
                                dr["OutStock"]=true;
                            }
                            this.gridView1.OptionsBehavior.Editable=false;
                        }
                        this.simpleButton1.Enabled=false;
                        this.gridControl1.DataSource=ds.Tables[0];
                    }
                    else
                    {
                        this.simpleButton1.Enabled=false;
                    }
                }
                else
                {
                    UI.ShowErrorMessage(this,"No record(s) found","Error");
                }

            }

            //
            //			DevExpress.XtraGrid.Columns.GridColumn col3 = gridView1.Columns.ColumnByFieldName("OutStock");
            //
            //
            //			for(int i=0;i<this.gridView1.DataRowCount;i++)
            //			{
            //				this.gridView1.g
            //			}
        }