private void txt_destinationLocId_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                if (ActiveControl.Name.Trim() == txt_destinationLocId.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["LocaFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["LocaSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["LocaField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }
                txt_reqLocationId_name.Text = findExisting.FindExisitingLoca(txt_destinationLocId.Text);
            }

            if (e.KeyCode == Keys.Enter)
            {
                txt_reqLocationId_name.Text = findExisting.FindExisitingLoca(txt_destinationLocId.Text);
                txt_remarks.Focus();
                errorProvider1.Clear();
            }
        }
Beispiel #2
0
        private void txt_no_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                FindExisitingTransfer(txt_no.Text.Trim());
                txt_sourceLocId.Focus();
                errorProvider1.Clear();
            }

            if (e.KeyCode == Keys.F2)
            {
                if (ActiveControl.Name.Trim() == txt_no.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["StaffUSFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["StaffUSSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["StaffUSField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                FindExisitingTransfer(txt_no.Text.Trim());
            }
        }
        private void txt_itemcode2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                //txt_subcat.Focus();
                txt_itemcode2_name.Text = findExisting.FindExisitingProduct(txt_itemcode2.Text);
            }
            if (e.KeyCode == Keys.F2)
            {
                if (ActiveControl.Name.Trim() == txt_itemcode2.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["ProductFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["ProductSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["ProductField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }
            }
        }
Beispiel #4
0
        private void txt_DocNo_KeyDown(object sender, KeyEventArgs e)
        {
            errorProvider1.Clear();
            if (e.KeyCode == Keys.Enter)
            {
                FindExisitingCN(txt_DocNo.Text.Trim());
                //txt_code.Focus();
            }

            if (e.KeyCode == Keys.F2)
            {
                if (ActiveControl.Name.Trim() == txt_DocNo.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["CNHFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["CNHSQLFOrCNGrouped"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["CNHField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }
            }
        }
        private void txt_subcat_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                if (txt_Category.Text.Trim() != "")
                {
                    if (ActiveControl.Name.Trim() == txt_subcat.Name.Trim())
                    {
                        int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["CussubcatFieldLength"]);
                        string[] strSearchField = new string[length];

                        string strSQL = ConfigurationManager.AppSettings["CussubcatSQL"].ToString() + " WHERE CatID = '" + txt_Category.Text + "'";

                        for (int i = 0; i < length; i++)
                        {
                            string m;
                            m = i.ToString();
                            strSearchField[i] = ConfigurationManager.AppSettings["CussubcatField" + m + ""].ToString();
                        }

                        frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                        find.ShowDialog(this);
                    }
                }
                txt_subcat_name.Text = findExisting.FindExisitingCustomerSub(txt_Category.Text, txt_subcat.Text);
                rdo_subcat.Checked   = true;
            }
        }
        private void txt_Category_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                if (ActiveControl.Name.Trim() == txt_Category.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["CuscatFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["CuscatSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["CuscatField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                txt_categoryName.Text = findExisting.FindExisitingCustomerCategory(txt_Category.Text);
            }
        }
Beispiel #7
0
        private void txt_Suplier_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["SupplierFieldLength"]);
                string[] strSearchField = new string[length];

                string strSQL = ConfigurationManager.AppSettings["SupplierSQL"].ToString();

                for (int i = 0; i < length; i++)
                {
                    string m;
                    m = i.ToString();
                    strSearchField[i] = ConfigurationManager.AppSettings["SupplierField" + m + ""].ToString();
                }

                frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                find.ShowDialog(this);
            }
            if (e.KeyCode == Keys.Enter)
            {
                txt_suppliername.Text = findExisting.FindExisitingSupplier(txt_Suplier.Text);
                errorProvider1.Clear();
            }
        }
Beispiel #8
0
        private void txt_Routecode_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                SetValues(txt_Routecode.Text.Trim());
                txt_Descr.Focus();
            }
            if (e.KeyCode.Equals(Keys.F2))
            {
                int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["RUTypeFieldLength"]);
                string[] strSearchField = new string[length];

                string strSQL = ConfigurationManager.AppSettings["RUTypeSQL"].ToString();

                for (int i = 0; i < length; i++)
                {
                    string m;
                    m = i.ToString();
                    strSearchField[i] = ConfigurationManager.AppSettings["RUTypeField" + m + ""].ToString();
                }

                frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                find.ShowDialog(this);
                SetValues(txt_Routecode.Text.Trim());
            }
        }
Beispiel #9
0
        private void txt_subcat_KeyDown(object sender, KeyEventArgs e)
        {
            if (txt_Category.Text.Trim() == "")
            {
                commonFunctions.SetMDIStatusMessage("Please enter category first", 1);
                errorProvider1.SetError(txt_Category, "Please enter category first");
                return;
            }

            if (e.KeyCode == Keys.Enter)
            {
                //FindExisitingsubCategory();
            }
            if (e.KeyCode == Keys.F2)
            {
                int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["SUBCategoryFieldLength"]);
                string[] strSearchField = new string[length];

                string strSQL = ConfigurationManager.AppSettings["SUBCategorySQL"].ToString() + " FROM dbo.M_SubCategory WHERE (CategoryID = '" + txt_Category.Text.Trim() + "')";
                for (int i = 0; i < length; i++)
                {
                    string m;
                    m = i.ToString();
                    strSearchField[i] = ConfigurationManager.AppSettings["SUBCategoryField" + m + ""].ToString();
                }

                frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                find.ShowDialog(this);
            }
        }
        private void txt_salesman_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                txt_salesman_name.Text = findExisting.FindExisitingUSer(txt_salesman.Text);
                txt_cat.Focus();
            }
            if (e.KeyCode == Keys.F2)
            {
                if (ActiveControl.Name.Trim() == txt_salesman.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["UserFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["UserSQL"].ToString() + " where  TYPE = 'SAL' ";

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["UserField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                txt_salesman_name.Text = findExisting.FindExisitingUSer(txt_salesman.Text);
            }
        }
        private void txt_Lorry_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                txt_Agent.Focus();
            }
            if (e.KeyCode == Keys.F2)
            {
                if (ActiveControl.Name.Trim() == txt_Lorry.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["VehicleFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["VehicleSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["VehicleField" + m + ""].ToString();
                    }
                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }
            }
        }
        private void txt_product1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                if (rdo_productwise.Checked)
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["ProductFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["ProductSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["ProductField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }
                else if (rdo_lotwise.Checked)
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["ProductStockFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["ProductStockSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["ProductStockField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }
            }
            if (rdo_productwise.Checked)
            {
                txt_product1_name.Text = findExisting.FindExisitingProduct(txt_product1.Text);
            }
            else if (rdo_productwise.Checked)
            {
                txt_product1_name.Text = findExisting.FindExisitingStock(txt_product1.Text);
            }

            chk_Allproduct.Checked = false;
        }
        private void txt_agents_KeyDown(object sender, KeyEventArgs e)
        {
            errorProvider1.Clear();
            if (e.KeyCode == Keys.Enter)
            {
                if (!M_AgentDL.ExistingM_Agent(txt_agents.Text.Trim()))
                {
                    errorProvider1.SetError(txt_agents, "Agent does not exists on the system ");
                    return;
                }


                if (commonFunctions.IsExistINV(dataGridView2, txt_agents.Text))
                {
                    return;
                }
                commonFunctions.AddRowAgents(dtx, txt_agents.Text, txt_agents_name.Text.Trim());
            }

            if (e.KeyCode == Keys.F2)
            {
                if (ActiveControl.Name.Trim() == txt_agents.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["AgentFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["AgentSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["AgentField" + m + ""].ToString();
                    }
                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }
            }
        }
Beispiel #14
0
 private void txt_loca1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         txt_loca1_name.Text = findExisting.FindExisitingLoca(txt_loca1.Text);
     }
     if (e.KeyCode == Keys.F2)
     {
         int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["LocaFieldLength"]);
         string[] strSearchField = new string[length];
         string   strSQL         = ConfigurationManager.AppSettings["LocaSQL"].ToString();
         for (int i = 0; i < length; i++)
         {
             string m;
             m = i.ToString();
             strSearchField[i] = ConfigurationManager.AppSettings["LocaField" + m + ""].ToString();
         }
         frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
         find.ShowDialog(this);
     }
     txt_loca1_name.Text = findExisting.FindExisitingLoca(txt_loca1.Text);
     Chk_allLoca.Checked = false;
 }
Beispiel #15
0
        private void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                if (ActiveControl.Name.Trim() == textBox2.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["OrderFormReportsFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["OrderFormReportsUSSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["OrderFormReportsField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }
            }
        }
        private void txt_itemcode1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                rdo_stockCode.Checked = true;
            }
            if (e.KeyCode == Keys.F2)
            {
                int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["ProductStockFieldLength"]);
                string[] strSearchField = new string[length];

                string strSQL = ConfigurationManager.AppSettings["ProductStockSQL"].ToString() + " WHERE dbo.T_Stock.Locacode = '" + txt_loca.Text.Trim() + "'";

                for (int i = 0; i < length; i++)
                {
                    string m;
                    m = i.ToString();
                    strSearchField[i] = ConfigurationManager.AppSettings["ProductStockField" + m + ""].ToString();
                }

                frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                find.ShowDialog(this);
            }
        }
        private void txt_code_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                if (txt_destinationLocId.Text.Trim() == string.Empty)
                {
                    errorProvider1.SetError(txt_destinationLocId, "Please enter destination location code");
                    return;
                }
                if (ActiveControl.Name.Trim() == txt_code.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["ProductStockFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["ProductStockSQL"].ToString() + " WHERE T_Stock.Locacode = '" + txt_destinationLocId.Text.Trim() + "'";

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["ProductStockField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }
                errorProvider1.Clear();
            }

            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    //txt_code.Text = commonFunctions.GetProcutCode(txt_code.Text.Trim());
                    if (T_StockDL.ExistingT_Stock_new(txt_code.Text, commonFunctions.GlobalCompany, commonFunctions.GlobalLocation))
                    {
                        if (!commonFunctions.IsExist(dataGridView1, txt_code.Text))
                        {
                            GetStockdetails(txt_destinationLocId.Text.Trim());
                            txt_qty.Text = "0";
                            txt_qty.Focus();

                            errorProvider1.Clear();
                            already = false;
                        }
                        else
                        {
                            already = true;
                            GetStockdetails(txt_destinationLocId.Text.Trim());

                            DataGridViewRow drowx = new DataGridViewRow();
                            drowx = commonFunctions.GetRow(dataGridView1, txt_code.Text.Trim());

                            txt_qty.Text = drowx.Cells["Quntity"].Value.ToString();

                            txt_qty.Focus();
                        }
                    }
                    else
                    {
                        errorProvider1.SetError(txt_code, "Product you have entered not exist in the bin card");
                        commonFunctions.SetMDIStatusMessage("Product you have entered not exist in the bin card", 1);
                    }
                }
                catch (Exception ex)
                {
                    LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                    commonFunctions.SetMDIStatusMessage("Genaral Error", 1);
                    throw ex;
                }
            }
        }
        private void txt_code_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                if (ActiveControl.Name.Trim() == txt_code.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["ProductFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["ProductSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["ProductField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                //FindExisitingSupplier();
                errorProvider1.Clear();
            }

            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    //txt_code.Text = commonFunctions.GetProcutCode(txt_code.Text.Trim());
                    if (T_StockDL.ExistingT_Stock_Product(txt_code.Text, commonFunctions.GlobalCompany, commonFunctions.GlobalLocation))
                    {
                        if (!commonFunctions.IsExistINV(dataGridView1, txt_code.Text))
                        {
                            M_Products stk = new M_Products();
                            stk.Locacode = commonFunctions.GlobalLocation;
                            stk.Compcode = commonFunctions.GlobalCompany;
                            stk.IDX      = txt_code.Text;
                            stk          = new M_ProductDL().Selectm_Product(stk);

                            txt_cost.Text    = stk.CostPrice.ToString();
                            txt_selling.Text = stk.SellingPrice.ToString();
                            lbl_name.Text    = stk.Namex;

                            txt_qty.Text = "0";
                            txt_qty.Focus();

                            errorProvider1.Clear();
                            already = false;
                        }
                        else
                        {
                            already = true;
                            //errorProvider1.SetError(txt_code, "Already exists");
                            M_Products stk = new M_Products();
                            stk.Locacode = commonFunctions.GlobalLocation;
                            stk.Compcode = commonFunctions.GlobalCompany;
                            stk.IDX      = txt_code.Text;
                            stk          = new M_ProductDL().Selectm_Product(stk);

                            txt_cost.Text    = stk.CostPrice.ToString();
                            txt_selling.Text = stk.SellingPrice.ToString();
                            lbl_name.Text    = stk.Namex;

                            DataGridViewRow drowx = new DataGridViewRow();
                            drowx = commonFunctions.GetRow(dataGridView1, txt_code.Text.Trim());

                            txt_qty.Text = drowx.Cells["Quntity"].Value.ToString();

                            txt_qty.Focus();
                        }
                    }
                    else
                    {
                        errorProvider1.SetError(txt_code, "Product you have entered not exist in the product master file");
                        commonFunctions.SetMDIStatusMessage("Product you have entered not exist in the product master file", 1);
                    }
                }
                catch (Exception ex)
                {
                    LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                    commonFunctions.SetMDIStatusMessage("Genaral Error", 2);
                }
            }
        }
        private void performButtons(xEnums.PerformanceType xenum)
        {
            try
            {
                switch (xenum)
                {
                case xEnums.PerformanceType.View:
                    if (ActiveControl.Name.Trim() == txt_no.Name.Trim())
                    {
                        int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["POFieldLength"]);
                        string[] strSearchField = new string[length];

                        string strSQL = ConfigurationManager.AppSettings["POSQL"].ToString();

                        for (int i = 0; i < length; i++)
                        {
                            string m;
                            m = i.ToString();
                            strSearchField[i] = ConfigurationManager.AppSettings["POField" + m + ""].ToString();
                        }

                        frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                        find.ShowDialog(this);
                    }

                    break;

                case xEnums.PerformanceType.New:
                    FunctionButtonStatus(xEnums.PerformanceType.New);
                    formMode    = 1;
                    txt_no.Text = commonFunctions.GetSerial(formID.Trim());
                    txt_no.Focus();

                    txt_sourceLocId.Text     = commonFunctions.GlobalLocation;
                    txt_locationId_name.Text = findExisting.FindExisitingLoca(txt_sourceLocId.Text.Trim());

                    errorProvider1.Clear();

                    lbl_processes.Visible = false;
                    break;

                case xEnums.PerformanceType.Edit:
                    FunctionButtonStatus(xEnums.PerformanceType.Edit);
                    formMode = 3;
                    //txt_VehicleID.Enabled = false;
                    //txt_VehicleNo.Focus();
                    errorProvider1.Clear();
                    break;

                case xEnums.PerformanceType.Save:
                    errorProvider1.Clear();
                    if (formMode == 1)
                    {
                        if (txt_sourceLocId.Text.Trim().ToUpper() == txt_destinationLocId.Text.Trim().ToUpper())
                        {
                            errorProvider1.SetError(txt_destinationLocId, "Destination location cannot same as login location");
                            return;
                        }


                        if (!M_LocaDL.ExistingM_Loca(txt_sourceLocId.Text.Trim()))
                        {
                            errorProvider1.SetError(txt_sourceLocId, "Location does not exists on the system ");
                            commonFunctions.SetMDIStatusMessage("Location does not exists on the system", 1);
                            return;
                        }


                        if (!M_LocaDL.ExistingM_Loca(txt_destinationLocId.Text.Trim()))
                        {
                            errorProvider1.SetError(txt_destinationLocId, "Destination Location does not exists on the system ");
                            commonFunctions.SetMDIStatusMessage("Destination Location does not exists on the system", 1);

                            return;
                        }

                        if (commonFunctions.GetNoofItems(dataGridView1) <= 0)
                        {
                            errorProvider1.SetError(dataGridView1, "Please enter some items to the details grid");
                            commonFunctions.SetMDIStatusMessage("Please enter some items to the details grid", 1);

                            return;
                        }



                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            try
                            {
                                using (System.Transactions.TransactionScope transaction = new System.Transactions.TransactionScope())
                                {
                                    //u_DBConnection.BeginTrans();
                                    //save header data
                                    t_trnsferInNote objt_trnsferInNote = new t_trnsferInNote();
                                    objt_trnsferInNote.transinNo        = txt_no.Text.Trim();
                                    objt_trnsferInNote.sourceLocId      = commonFunctions.GlobalLocation;
                                    objt_trnsferInNote.date             = dte_date.Value;
                                    objt_trnsferInNote.refNo            = txt_refNo.Text.Trim();
                                    objt_trnsferInNote.remarks          = txt_remarks.Text.Trim();
                                    objt_trnsferInNote.destinationLocId = txt_destinationLocId.Text.Trim();
                                    objt_trnsferInNote.purchaseReqNo    = txt_purchaseReqNo.Text.Trim();
                                    objt_trnsferInNote.noOfItems        = commonFunctions.ToDecimal(txt_noOfItems.Text.Trim());
                                    objt_trnsferInNote.noOfPeaces       = commonFunctions.ToDecimal(txt_noOfPeaces.Text.Trim());
                                    objt_trnsferInNote.grossAmount      = commonFunctions.ToDecimal(txt_grossAmount.Text.Trim());
                                    objt_trnsferInNote.isProcessed      = false;
                                    objt_trnsferInNote.processDate      = DateTime.Now;
                                    objt_trnsferInNote.processUser      = "";
                                    objt_trnsferInNote.GLUpdate         = false;
                                    objt_trnsferInNote.triggerVal       = 1;
                                    T_trnsferInNoteDL bal = new T_trnsferInNoteDL();
                                    bal.Savet_trnsferInNoteSP(objt_trnsferInNote, 1);


                                    //save details
                                    foreach (DataGridViewRow drow in dataGridView1.Rows)
                                    {
                                        if (drow.Cells["Product Code"].Value.ToString().Trim() != null)
                                        {
                                            t_transferIn_detail objt_transferIn_detail = new t_transferIn_detail();
                                            objt_transferIn_detail.transinrNo       = txt_no.Text.Trim();
                                            objt_transferIn_detail.sourceLocId      = commonFunctions.GlobalLocation;
                                            objt_transferIn_detail.destinationLocId = txt_destinationLocId.Text.Trim();
                                            objt_transferIn_detail.transferDate     = dte_date.Value;
                                            objt_transferIn_detail.stockCode        = drow.Cells["Product Code"].Value.ToString();
                                            objt_transferIn_detail.description      = drow.Cells["Product Name"].Value.ToString();
                                            objt_transferIn_detail.quantity         = commonFunctions.ToDecimal(drow.Cells["Quntity"].Value.ToString());
                                            objt_transferIn_detail.costPrice        = commonFunctions.ToDecimal(drow.Cells["Cost Price"].Value.ToString());
                                            objt_transferIn_detail.amount           = commonFunctions.ToDecimal(drow.Cells["Amount"].Value.ToString());
                                            objt_transferIn_detail.triggerVal       = 1;
                                            T_transferIn_detailDL bal2 = new T_transferIn_detailDL();
                                            bal2.Savet_transferIn_detailSP(objt_transferIn_detail, 1);
                                        }
                                    }

                                    //increment the serial
                                    commonFunctions.IncrementSerial(formID);
                                    transaction.Complete();
                                    //u_DBConnection.CommitTrans();
                                    UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Save_Sucess, commonFunctions.Softwarename.Trim());
                                }
                            }
                            catch (Exception ex)
                            {
                                // u_DBConnection.RollbackTrans();
                                LogFile.WriteErrorLog("Save Transactions", "Transfer In", ex.Message);
                                LogFile.WriteErrorLog("Save Transactions", "Transfer Out", ex.Message);
                                commonFunctions.SetMDIStatusMessage("Transfer Number you have entered already processed", 1);
                            }

                            if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Process, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                            {
                                UpdateStock();

                                t_trnsferInNote objt_trnsferNote = new t_trnsferInNote();
                                objt_trnsferNote.transinNo = txt_no.Text.Trim();

                                T_trnsferInNoteDL balprocess = new T_trnsferInNoteDL();
                                objt_trnsferNote = balprocess.Selectt_trnsferInNote(objt_trnsferNote);

                                objt_trnsferNote.isProcessed = true;
                                objt_trnsferNote.processDate = DateTime.Now;
                                objt_trnsferNote.processUser = commonFunctions.Loginuser;
                                balprocess.Savet_trnsferInNoteSP(objt_trnsferNote, 3);
                                UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Update_Sucess, commonFunctions.Softwarename.Trim());
                            }


                            //clear data in data grid
                            dtx.Rows.Clear();
                            dataGridView1.Refresh();
                            //clear text fields
                            textareaFunctions(true);

                            FunctionButtonStatus(xEnums.PerformanceType.Save);
                            //increment the serial
                            txt_no.Text = commonFunctions.GetSerial(formID.Trim());
                            //txt_supplierId.Focus();
                        }
                    }
                    else if (formMode == 3)
                    {
                        t_trnsferInNote cat = new t_trnsferInNote();
                        cat.transinNo = txt_no.Text.Trim();
                        T_trnsferInNoteDL dl = new T_trnsferInNoteDL();
                        cat = dl.Selectt_trnsferInNote(cat);
                        if (cat.isProcessed == false)
                        {
                            if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Process, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                            {
                                UpdateStock();

                                t_trnsferInNote objt_trnsferNote = new t_trnsferInNote();
                                objt_trnsferNote.transinNo = txt_no.Text.Trim();

                                T_trnsferInNoteDL balprocess = new T_trnsferInNoteDL();
                                objt_trnsferNote = balprocess.Selectt_trnsferInNote(objt_trnsferNote);

                                objt_trnsferNote.isProcessed = true;
                                objt_trnsferNote.processDate = DateTime.Now;
                                objt_trnsferNote.processUser = commonFunctions.Loginuser;
                                balprocess.Savet_trnsferInNoteSP(objt_trnsferNote, 3);
                                UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Update_Sucess, commonFunctions.Softwarename.Trim());



                                //clear data in data grid
                                dtx.Rows.Clear();
                                dataGridView1.Refresh();
                                //clear text fields
                                textareaFunctions(true);
                                FunctionButtonStatus(xEnums.PerformanceType.Save);

                                txt_no.Text = commonFunctions.GetSerial(formID.Trim());
                                txt_refNo.Focus();
                            }
                        }
                        else
                        {
                            errorProvider1.SetError(txt_no, "Transfer IN Number you have entered already processed.");
                        }
                    }
                    break;

                case xEnums.PerformanceType.Cancel:
                    txt_no.Enabled = true;
                    FunctionButtonStatus(xEnums.PerformanceType.Default);
                    errorProvider1.Clear();
                    //clear text fields
                    textareaFunctions(true);
                    //clear Datagrid
                    dtx.Clear();
                    dataGridView1.Refresh();

                    //txt_supplierId.Text = "";
                    txt_remarks.Text = "";

                    lbl_processes.Visible = false;

                    break;

                case xEnums.PerformanceType.Print:
                    UserDefineMessages.ShowMsg1("Print still in process", UserDefineMessages.Msg_Information);
                    break;
                }
            }
            catch (Exception ex)
            {
                LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                commonFunctions.SetMDIStatusMessage("Genaral Error on loading data", 1);
            }
        }
Beispiel #20
0
        private void performButtons(xEnums.PerformanceType xenum)
        {
            try
            {
                switch (xenum)
                {
                case xEnums.PerformanceType.View:
                    if (ActiveControl.Name.Trim() == txt_no.Name.Trim())
                    {
                        int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["POFieldLength"]);
                        string[] strSearchField = new string[length];

                        string strSQL = ConfigurationManager.AppSettings["POSQL"].ToString();

                        for (int i = 0; i < length; i++)
                        {
                            string m;
                            m = i.ToString();
                            strSearchField[i] = ConfigurationManager.AppSettings["POField" + m + ""].ToString();
                        }

                        frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                        find.ShowDialog(this);
                    }

                    break;

                case xEnums.PerformanceType.New:
                    FunctionButtonStatus(xEnums.PerformanceType.New);
                    formMode    = 1;
                    txt_no.Text = commonFunctions.GetSerial(formID.Trim());
                    txt_no.Focus();

                    txt_sourceLocId.Text     = commonFunctions.GlobalLocation;
                    txt_locationId_name.Text = findExisting.FindExisitingLoca(txt_sourceLocId.Text.Trim());

                    errorProvider1.Clear();

                    lbl_processes.Visible = false;
                    break;

                case xEnums.PerformanceType.Edit:
                    FunctionButtonStatus(xEnums.PerformanceType.Edit);
                    formMode = 3;
                    //txt_VehicleID.Enabled = false;
                    //txt_VehicleNo.Focus();
                    errorProvider1.Clear();
                    break;

                case xEnums.PerformanceType.Save:
                    errorProvider1.Clear();
                    if (formMode == 1)
                    {
                        if (!M_LocaDL.ExistingM_Loca(txt_sourceLocId.Text.Trim()))
                        {
                            errorProvider1.SetError(txt_sourceLocId, "Location does not exists on the system ");
                            commonFunctions.SetMDIStatusMessage("Location does not exists on the system", 1);
                            return;
                        }

                        if (commonFunctions.GetNoofItems(dataGridView1) <= 0)
                        {
                            errorProvider1.SetError(dataGridView1, "Please enter some items to the details grid");
                            commonFunctions.SetMDIStatusMessage("Please enter some items to the details grid", 1);
                            return;
                        }



                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            try
                            {
                                using (System.Transactions.TransactionScope transaction = new System.Transactions.TransactionScope())
                                {
                                    //u_DBConnection.BeginTrans();
                                    //save header data
                                    t_adjustment_head objt_adjustment_head = new t_adjustment_head();

                                    objt_adjustment_head.adju_no       = txt_no.Text.Trim();
                                    objt_adjustment_head.location_id   = commonFunctions.GlobalLocation;
                                    objt_adjustment_head.adjsment_date = dte_date.Value;
                                    objt_adjustment_head.remarks       = txt_remarks.Text.Trim();
                                    objt_adjustment_head.user_id       = commonFunctions.Loginuser;
                                    objt_adjustment_head.batch_no      = txt_batch_no.Text.Trim();
                                    objt_adjustment_head.process       = false;
                                    objt_adjustment_head.process_user  = commonFunctions.Loginuser;
                                    objt_adjustment_head.process_date  = DateTime.Now;
                                    objt_adjustment_head.triggerVal    = 1;
                                    T_adjustment_headDL bal = new T_adjustment_headDL();
                                    bal.Savet_adjustment_headSP(objt_adjustment_head, 1);


                                    //save details
                                    foreach (DataGridViewRow drow in dataGridView1.Rows)
                                    {
                                        if (drow.Cells["Product Code"].Value.ToString().Trim() != null)
                                        {
                                            //have to implement the logic. this is only saving the data to the system
                                            t_adjustment_details objt_adjustment_detail = new t_adjustment_details();
                                            objt_adjustment_detail.adju_no           = txt_no.Text.Trim();
                                            objt_adjustment_detail.location_id       = commonFunctions.GlobalLocation;
                                            objt_adjustment_detail.line_no           = 1;
                                            objt_adjustment_detail.item_code         = drow.Cells["Product Code"].Value.ToString();
                                            objt_adjustment_detail.cost              = commonFunctions.ToDecimal(drow.Cells["Cost Price"].Value.ToString());
                                            objt_adjustment_detail.stock             = commonFunctions.ToDecimal(drow.Cells["Quntity"].Value.ToString());
                                            objt_adjustment_detail.physical_quantity = commonFunctions.ToDecimal(drow.Cells["Quntity"].Value.ToString());    //txt_physical_quantity.Text.Trim();
                                            objt_adjustment_detail.variance          = commonFunctions.ToDecimal(drow.Cells["Quntity"].Value.ToString());
                                            if (rdo_add.Checked)
                                            {
                                                objt_adjustment_detail.triggerVal = 1;
                                            }
                                            if (rdo_reduce.Checked)
                                            {
                                                objt_adjustment_detail.triggerVal = 2;
                                            }
                                            T_adjustment_detailDL bal2 = new T_adjustment_detailDL();
                                            bal2.Savet_adjustment_detailSP(objt_adjustment_detail, 1);
                                        }
                                    }

                                    //increment the serial
                                    commonFunctions.IncrementSerial(formID);
                                    transaction.Complete();
                                }
                                //u_DBConnection.CommitTrans();
                                UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Save_Sucess, commonFunctions.Softwarename.Trim());
                            }
                            catch (Exception ex)
                            {
                                // u_DBConnection.RollbackTrans();
                                LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                                commonFunctions.SetMDIStatusMessage("Genaral Error on loading data", 1);
                            }

                            if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Process, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                            {
                                UpdateStock();

                                t_adjustment_head objt_trnsferNote = new t_adjustment_head();
                                objt_trnsferNote.adju_no = txt_no.Text.Trim();

                                T_adjustment_headDL balprocess = new T_adjustment_headDL();
                                objt_trnsferNote = balprocess.Selectt_adjustment_head(objt_trnsferNote);

                                objt_trnsferNote.process      = true;
                                objt_trnsferNote.process_date = DateTime.Now;
                                objt_trnsferNote.process_user = commonFunctions.Loginuser;
                                balprocess.Savet_adjustment_headSP(objt_trnsferNote, 3);
                                UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Update_Sucess, commonFunctions.Softwarename.Trim());
                            }


                            //clear data in data grid
                            dtx.Rows.Clear();
                            dataGridView1.Refresh();
                            //clear text fields
                            textareaFunctions(true);

                            FunctionButtonStatus(xEnums.PerformanceType.Save);
                            //increment the serial
                            txt_no.Text = commonFunctions.GetSerial(formID.Trim());
                            //txt_supplierId.Focus();
                        }
                    }
                    else if (formMode == 3)
                    {
                        t_adjustment_head cat = new t_adjustment_head();
                        cat.adju_no = txt_no.Text.Trim();
                        T_adjustment_headDL dl = new T_adjustment_headDL();
                        cat = dl.Selectt_adjustment_head(cat);
                        if (cat.process == false)
                        {
                            if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Process, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                            {
                                cat.location_id   = txt_sourceLocId.Text.Trim();
                                cat.adjsment_date = dte_date.Value;
                                cat.remarks       = txt_remarks.Text.Trim();
                                cat.user_id       = commonFunctions.Loginuser;
                                cat.batch_no      = txt_batch_no.Text.Trim();
                                new T_adjustment_headDL().Savet_adjustment_headSP(cat, 3);

                                List <t_adjustment_details> detsx = new List <t_adjustment_details>();
                                t_adjustment_details        detx  = new t_adjustment_details();
                                detx.adju_no = cat.adju_no.Trim();
                                detsx        = new T_adjustment_detailDL().SelectT_adjustment_detailMulti(detx);
                                foreach (t_adjustment_details det in detsx)
                                {
                                    new T_adjustment_detailDL().Savet_adjustment_detailSP(det, 4);
                                }
                                //save details
                                foreach (DataGridViewRow drow in dataGridView1.Rows)
                                {
                                    if (drow.Cells["Product Code"].Value.ToString().Trim() != null)
                                    {
                                        //have to implement the logic. this is only saving the data to the system
                                        t_adjustment_details objt_adjustment_detail = new t_adjustment_details();
                                        objt_adjustment_detail.adju_no           = txt_no.Text.Trim();
                                        objt_adjustment_detail.location_id       = txt_sourceLocId.Text.Trim();
                                        objt_adjustment_detail.line_no           = 1;
                                        objt_adjustment_detail.item_code         = drow.Cells["Product Code"].Value.ToString();
                                        objt_adjustment_detail.cost              = commonFunctions.ToDecimal(drow.Cells["Cost Price"].Value.ToString());
                                        objt_adjustment_detail.stock             = commonFunctions.ToDecimal(drow.Cells["Quntity"].Value.ToString());
                                        objt_adjustment_detail.physical_quantity = commonFunctions.ToDecimal(drow.Cells["Quntity"].Value.ToString());    //txt_physical_quantity.Text.Trim();
                                        objt_adjustment_detail.variance          = commonFunctions.ToDecimal(drow.Cells["Quntity"].Value.ToString());
                                        if (rdo_add.Checked)
                                        {
                                            objt_adjustment_detail.triggerVal = 1;
                                        }
                                        if (rdo_reduce.Checked)
                                        {
                                            objt_adjustment_detail.triggerVal = 2;
                                        }
                                        T_adjustment_detailDL bal2 = new T_adjustment_detailDL();
                                        bal2.Savet_adjustment_detailSP(objt_adjustment_detail, 1);
                                    }
                                }

                                if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Process, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                                {
                                    cat.process      = true;
                                    cat.process_date = DateTime.Now;
                                    cat.process_user = commonFunctions.Loginuser;
                                    new T_adjustment_headDL().Savet_adjustment_headSP(cat, 3);
                                    UpdateStock();
                                }

                                UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Update_Sucess, commonFunctions.Softwarename.Trim());

                                //clear data in data grid
                                dtx.Rows.Clear();
                                dataGridView1.Refresh();
                                //clear text fields
                                textareaFunctions(true);
                                FunctionButtonStatus(xEnums.PerformanceType.Save);

                                txt_no.Text = commonFunctions.GetSerial(formID.Trim());
                                txt_code.Focus();
                            }
                        }
                        else
                        {
                            errorProvider1.SetError(txt_no, "Adjustment Number you have entered already processed.");
                            commonFunctions.SetMDIStatusMessage("Adjustment Number you have entered already processed", 1);
                        }
                    }
                    break;

                case xEnums.PerformanceType.Cancel:
                    txt_no.Enabled = true;
                    FunctionButtonStatus(xEnums.PerformanceType.Default);
                    errorProvider1.Clear();
                    //clear text fields
                    textareaFunctions(true);
                    //clear Datagrid
                    dtx.Clear();
                    dataGridView1.Refresh();

                    //txt_supplierId.Text = "";
                    //txt_remarks.Text = "";

                    lbl_processes.Visible = false;

                    break;

                case xEnums.PerformanceType.Print:
                    UserDefineMessages.ShowMsg1("Print still in process", UserDefineMessages.Msg_Information);
                    break;
                }
            }
            catch (Exception ex)
            {
                LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                commonFunctions.SetMDIStatusMessage("Genaral Error on updating data", 1);
            }
        }
        private void performButtons(xEnums.PerformanceType xenum)
        {
            try
            {
                switch (xenum)
                {
                case xEnums.PerformanceType.View:

                    if (ActiveControl.Name.Trim() == txt_reqno.Name.Trim())
                    {
                        int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["PurreqFieldLength"]);
                        string[] strSearchField = new string[length];

                        string strSQL = ConfigurationManager.AppSettings["PurreqField"].ToString();

                        for (int i = 0; i < length; i++)
                        {
                            string m;
                            m = i.ToString();
                            strSearchField[i] = ConfigurationManager.AppSettings["VehicleField" + m + ""].ToString();
                        }

                        frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                        find.ShowDialog(this);
                    }

                    break;

                case xEnums.PerformanceType.New:
                    FunctionButtonStatus(xEnums.PerformanceType.New);
                    formMode       = 1;
                    txt_reqno.Text = commonFunctions.GetSerial(formID.Trim());

                    txt_reqno.Focus();
                    errorProvider1.Clear();

                    lbl_processes.Visible = false;
                    break;

                case xEnums.PerformanceType.Edit:
                    FunctionButtonStatus(xEnums.PerformanceType.Edit);
                    formMode = 3;
                    //txt_VehicleID.Enabled = false;
                    //txt_VehicleNo.Focus();
                    errorProvider1.Clear();
                    break;

                case xEnums.PerformanceType.Save:
                    errorProvider1.Clear();
                    if (formMode == 1)
                    {
                        if (T_purchaseRequisitionDL.ExistingT_purchaseRequisition(txt_reqno.Text.Trim()))
                        {
                            errorProvider1.SetError(txt_reqno, "Selected request No already exists on the system ");
                            commonFunctions.SetMDIStatusMessage("Selected request No already exists on the system ", 1);
                            return;
                        }

                        if (!M_LocaDL.ExistingM_Loca(txt_location.Text.Trim()))
                        {
                            errorProvider1.SetError(txt_location, "Selected location does not exists on the system ");
                            commonFunctions.SetMDIStatusMessage("Selected location does not exists on the system", 1);
                            return;
                        }

                        if (!M_SupplierDL.ExistingM_Supplier(txt_Suplier.Text.Trim()))
                        {
                            errorProvider1.SetError(txt_Suplier, "Selected supplier does not exists on the system ");
                            commonFunctions.SetMDIStatusMessage("Selected supplier does not exists on the system ", 1);
                            return;
                        }

                        if (commonFunctions.GetNoofItems(dataGridView1) <= 0)
                        {
                            errorProvider1.SetError(dataGridView1, "Please enter some items to the details grid");
                            commonFunctions.SetMDIStatusMessage("Please enter some items to the details grid ", 1);
                            return;
                        }

                        if (DateTime.Compare(dte_request.Value, dte_dilivary.Value) > -1)
                        {
                            errorProvider1.SetError(dte_dilivary, "Delivary date must be grater than request date");
                            commonFunctions.SetMDIStatusMessage("Delivary date must be grater than request date ", 1);
                            return;
                        }


                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            using (TransactionScope transaction = new TransactionScope())
                            {
                                //save header data
                                t_purchaseRequisition objt_purchaseRequisition = new t_purchaseRequisition();
                                objt_purchaseRequisition.no           = txt_reqno.Text.Trim();
                                objt_purchaseRequisition.date         = dte_request.Value;
                                objt_purchaseRequisition.deleveryDate = dte_dilivary.Value;
                                objt_purchaseRequisition.remarks      = txt_remark.Text.Trim();
                                objt_purchaseRequisition.processDate  = DateTime.Now;
                                objt_purchaseRequisition.processUser  = "";
                                objt_purchaseRequisition.locationId   = commonFunctions.GlobalLocation;
                                objt_purchaseRequisition.supplierId   = txt_Suplier.Text.Trim();
                                objt_purchaseRequisition.noOfItems    = commonFunctions.ToDecimal(txt_items.Text.Trim());
                                objt_purchaseRequisition.noOfPeaces   = commonFunctions.ToDecimal(txt_pices.Text.Trim());
                                objt_purchaseRequisition.grossAmount  = commonFunctions.ToDecimal(txt_gross.Text.Trim());
                                objt_purchaseRequisition.isSaved      = true;
                                objt_purchaseRequisition.isProcessed  = false;
                                objt_purchaseRequisition.triggerVal   = 1;
                                T_purchaseRequisitionDL bal = new T_purchaseRequisitionDL();
                                bal.SaveT_purchaseRequisitionSP(objt_purchaseRequisition, 1);

                                //save details
                                foreach (DataGridViewRow drow in dataGridView1.Rows)
                                {
                                    if (drow.Cells["Product Code"].Value.ToString().Trim() != null)
                                    {
                                        t_purchaseReq_detail objt_purchaseReq_detail = new t_purchaseReq_detail();
                                        objt_purchaseReq_detail.purchaseReqNo = txt_reqno.Text.Trim();
                                        objt_purchaseReq_detail.locationId    = commonFunctions.GlobalLocation;
                                        objt_purchaseReq_detail.ReqDate       = dte_request.Value;
                                        objt_purchaseReq_detail.deleveryDate  = dte_dilivary.Value;
                                        objt_purchaseReq_detail.productId     = drow.Cells["Product Code"].Value.ToString();
                                        objt_purchaseReq_detail.description   = drow.Cells["Product Name"].Value.ToString();
                                        objt_purchaseReq_detail.quantity      = commonFunctions.ToDecimal(drow.Cells["Quntity"].Value.ToString());
                                        objt_purchaseReq_detail.costPrice     = commonFunctions.ToDecimal(drow.Cells["Cost Price"].Value.ToString());
                                        objt_purchaseReq_detail.amount        = commonFunctions.ToDecimal(drow.Cells["Amount"].Value.ToString());
                                        objt_purchaseReq_detail.release       = 0;
                                        objt_purchaseReq_detail.r_value       = 0;
                                        objt_purchaseReq_detail.triggerVal    = 0;
                                        T_purchaseReq_detailDL bal2 = new T_purchaseReq_detailDL();
                                        bal2.SaveT_purchaseReq_detailSP(objt_purchaseReq_detail, 1);
                                    }
                                }

                                //increment the serial
                                commonFunctions.IncrementSerial(formID);
                                transaction.Complete();
                            }

                            UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Save_Sucess, commonFunctions.Softwarename.Trim());

                            if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Process, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                            {
                                t_purchaseRequisition objt_purchaseRequisitionxc = new t_purchaseRequisition();
                                objt_purchaseRequisitionxc.no = txt_reqno.Text.Trim();

                                T_purchaseRequisitionDL bal2 = new T_purchaseRequisitionDL();
                                objt_purchaseRequisitionxc             = bal2.Selectt_purchaseRequisition(objt_purchaseRequisitionxc);
                                objt_purchaseRequisitionxc.isProcessed = true;
                                objt_purchaseRequisitionxc.processDate = DateTime.Now;
                                objt_purchaseRequisitionxc.processUser = commonFunctions.Loginuser;
                                bal2.SaveT_purchaseRequisitionSP(objt_purchaseRequisitionxc, 3);
                                UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Update_Sucess, commonFunctions.Softwarename.Trim());
                            }


                            //clear data in data grid
                            dtx.Rows.Clear();
                            dataGridView1.Refresh();
                            //clear text fields
                            txt_Suplier.Text      = "";
                            txt_suppliername.Text = "";
                            txt_location.Text     = "";
                            txt_locaname.Text     = "";
                            txt_remark.Text       = "";

                            txt_code.Text    = "";
                            txt_cost.Text    = "0.00";
                            txt_selling.Text = "0.00";
                            txt_qty.Text     = "0.00";
                            txt_amt.Text     = "0.00";


                            txt_reqno.Enabled     = true;
                            txt_Suplier.Enabled   = true;
                            txt_location.Enabled  = true;
                            txt_remark.Enabled    = true;
                            dataGridView1.Enabled = true;

                            FunctionButtonStatus(xEnums.PerformanceType.Save);
                            //increment the serial
                            txt_reqno.Text = commonFunctions.GetSerial(formID.Trim());
                            txt_location.Focus();
                        }
                    }
                    else if (formMode == 3)
                    {
                        t_purchaseRequisition cat = new t_purchaseRequisition();
                        cat.no = txt_reqno.Text.Trim();
                        T_purchaseRequisitionDL dl = new T_purchaseRequisitionDL();
                        cat = dl.Selectt_purchaseRequisition(cat);
                        if (cat.isProcessed == false)
                        {
                            if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Process, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                            {
                                t_purchaseRequisition objt_purchaseRequisitionxc = new t_purchaseRequisition();
                                objt_purchaseRequisitionxc.no = txt_reqno.Text.Trim();

                                T_purchaseRequisitionDL bal2 = new T_purchaseRequisitionDL();
                                objt_purchaseRequisitionxc             = bal2.Selectt_purchaseRequisition(objt_purchaseRequisitionxc);
                                objt_purchaseRequisitionxc.isProcessed = true;
                                objt_purchaseRequisitionxc.processDate = DateTime.Now;
                                objt_purchaseRequisitionxc.processUser = commonFunctions.Loginuser;
                                bal2.SaveT_purchaseRequisitionSP(objt_purchaseRequisitionxc, 3);
                                UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Update_Sucess, commonFunctions.Softwarename.Trim());



                                //clear data in data grid
                                dtx.Rows.Clear();
                                dataGridView1.Refresh();
                                //clear text fields
                                txt_Suplier.Text      = "";
                                txt_suppliername.Text = "";
                                txt_location.Text     = "";
                                txt_locaname.Text     = "";
                                txt_remark.Text       = "";

                                txt_reqno.Enabled     = true;
                                txt_Suplier.Enabled   = true;
                                txt_location.Enabled  = true;
                                txt_remark.Enabled    = true;
                                dataGridView1.Enabled = true;

                                FunctionButtonStatus(xEnums.PerformanceType.Save);
                                //increment the serial
                                txt_reqno.Text = commonFunctions.GetSerial(formID.Trim());
                                txt_location.Focus();
                            }
                        }
                        else
                        {
                            errorProvider1.SetError(txt_reqno, "Request Number you have entered already processed.");
                            commonFunctions.SetMDIStatusMessage("Request Number you have entered already processed.", 1);
                        }
                    }
                    break;

                case xEnums.PerformanceType.Cancel:
                    txt_reqno.Enabled = true;
                    FunctionButtonStatus(xEnums.PerformanceType.Default);
                    errorProvider1.Clear();
                    txt_Suplier.Enabled   = true;
                    txt_location.Enabled  = true;
                    txt_remark.Enabled    = true;
                    dataGridView1.Enabled = true;

                    dtx.Clear();
                    dataGridView1.Refresh();
                    txt_Suplier.Text  = "";
                    txt_location.Text = "";
                    txt_remark.Text   = "";

                    lbl_processes.Visible = false;

                    break;

                case xEnums.PerformanceType.Print:
                    UserDefineMessages.ShowMsg1("Print still in process", UserDefineMessages.Msg_Information);
                    break;
                }
            }
            catch (Exception ex)
            {
                LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                commonFunctions.SetMDIStatusMessage("Genaral Error on updating data", 1);
            }
        }
Beispiel #22
0
        private void performButtons(xEnums.PerformanceType xenum)
        {
            switch (xenum)
            {
            case xEnums.PerformanceType.View:

                if (ActiveControl.Name.Trim() == txt_SalesmanID.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["SalesmanFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["SalesmanSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["SalesmanField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                break;

            case xEnums.PerformanceType.New:
                FunctionButtonStatus(xEnums.PerformanceType.New);
                //txt_IDX.Text = commonFunctions.GetSerial("A0009");
                formMode = 1;
                txt_SalesmanID.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Edit:
                FunctionButtonStatus(xEnums.PerformanceType.Edit);
                formMode = 3;
                txt_SalesmanID.Enabled = false;
                txt_SalesmanName.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Save:
                errorProvider1.Clear();
                if (txt_SalesmanID.Text.Trim().ToUpper() == "ADMIN")
                {
                    errorProvider1.SetError(txt_SalesmanID, "This user is the system administrator. you cannot change the details.");
                    commonFunctions.SetMDIStatusMessage("This user is the system administrator. you cannot change the details.", 1);
                    return;
                }

                if (txt_SalesmanID.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_SalesmanID, "User code cannot be a null value.");
                    commonFunctions.SetMDIStatusMessage("User code cannot be a null value.", 1);
                    return;
                }
                if (txt_SalesmanID.Text.Trim().Length < 5)
                {
                    errorProvider1.SetError(txt_SalesmanID, "User code must be more than 6 charactors.");
                    commonFunctions.SetMDIStatusMessage("User code must be more than 6 charactors", 1);
                    return;
                }

                if (txt_SalesmanName.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_SalesmanName, "User name cannot be a null value.");
                    commonFunctions.SetMDIStatusMessage("User name cannot be a null value.", 1);
                    return;
                }

                if (txtPw.Text == "")
                {
                    errorProvider1.SetError(txtPw, "Password cannot be a null value.");
                    commonFunctions.SetMDIStatusMessage("Password cannot be a null value.", 1);
                    return;
                }
                if (txtPw.Text != txtRePw.Text)
                {
                    errorProvider1.SetError(txtPw, "Password and the confirmation password must be same");
                    commonFunctions.SetMDIStatusMessage("Password and the confirmation password must be same.", 1);
                    return;
                }
                if (!U_UserRolexDL.ExistingU_UserRole(txtusergroup.Text.Trim()))
                {
                    errorProvider1.SetError(txtusergroup, "User group already exists.");
                    commonFunctions.SetMDIStatusMessage("User group already exists.", 1);
                    return;
                }

                if (txt_SalesmanName.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_SalesmanName, "Please enter a employee name !");
                    commonFunctions.SetMDIStatusMessage("Please enter a employee name.", 1);
                    return;
                }

                if (txt_SalesmanID.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_SalesmanID, "Please enter a employee name !");
                    commonFunctions.SetMDIStatusMessage("Please enter a employee name.", 1);
                    return;
                }

                if (formMode == 1)
                {
                    if (U_UserxDL.ExistingU_User(txt_SalesmanID.Text.Trim()))
                    {
                        errorProvider1.SetError(txt_SalesmanID, "User code already exists.");
                        commonFunctions.SetMDIStatusMessage("User code already exists.", 1);
                        return;
                    }
                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        u_Userxcc obju_User = new u_Userxcc();
                        obju_User.userId          = txt_SalesmanID.Text.Trim();
                        obju_User.userName        = txt_SalesmanName.Text.Trim();
                        obju_User.password        = commonFunctions.CreateCheckPassword(true, txtPw.Text.Trim());
                        obju_User.roleId          = txtusergroup.Text.Trim();
                        obju_User.userCreated     = commonFunctions.Loginuser;
                        obju_User.dateCreated     = DateTime.Now;
                        obju_User.userModified    = "";
                        obju_User.dateModified    = DateTime.Now;
                        obju_User.isActive        = 1;
                        obju_User.Type            = txt_paymeth.Text.Trim().ToUpper();
                        obju_User.Compcode        = commonFunctions.GlobalCompany;
                        obju_User.Locacode        = commonFunctions.GlobalLocation;
                        obju_User.TP              = txt_TP.Text.Trim();
                        obju_User.Fax             = txt_Fax.Text.Trim();
                        obju_User.Email           = txt_Email.Text.Trim();
                        obju_User.Address1        = txt_Address1.Text.Trim();
                        obju_User.Address2        = txt_Address2.Text.Trim();
                        obju_User.Address3        = txt_Address3.Text.Trim();
                        obju_User.ContactPerson   = txt_ContactPerson.Text.Trim();
                        obju_User.ContactPersonNo = txt_ContactPersonNo.Text.Trim();
                        obju_User.CurrentStatus   = "Active";
                        obju_User.Gradex          = "Good";
                        obju_User.NICNo           = txt_nic.Text.Trim();
                        new U_UserxDL().Saveu_UserSP(obju_User, 1);

                        GetData();

                        txt_SalesmanID.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);
                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                    }
                }
                else if (formMode == 3)
                {
                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        u_Userxcc obju_User = new u_Userxcc();
                        obju_User.userId = txt_SalesmanID.Text.Trim();
                        obju_User        = new U_UserxDL().Selectu_User(obju_User);

                        obju_User.userId          = txt_SalesmanID.Text.Trim();
                        obju_User.userName        = txt_SalesmanName.Text.Trim();
                        obju_User.password        = commonFunctions.CreateCheckPassword(true, txtPw.Text.Trim());
                        obju_User.roleId          = txtusergroup.Text.Trim();
                        obju_User.userCreated     = commonFunctions.Loginuser;
                        obju_User.dateCreated     = DateTime.Now;
                        obju_User.userModified    = "";
                        obju_User.dateModified    = DateTime.Now;
                        obju_User.isActive        = 1;
                        obju_User.Type            = txt_paymeth.Text.Trim().ToUpper();
                        obju_User.Compcode        = commonFunctions.GlobalCompany;
                        obju_User.Locacode        = commonFunctions.GlobalLocation;
                        obju_User.TP              = txt_TP.Text.Trim();
                        obju_User.Fax             = txt_Fax.Text.Trim();
                        obju_User.Email           = txt_Email.Text.Trim();
                        obju_User.Address1        = txt_Address1.Text.Trim();
                        obju_User.Address2        = txt_Address2.Text.Trim();
                        obju_User.Address3        = txt_Address3.Text.Trim();
                        obju_User.ContactPerson   = txt_ContactPerson.Text.Trim();
                        obju_User.ContactPersonNo = txt_ContactPersonNo.Text.Trim();
                        obju_User.CurrentStatus   = "Active";
                        obju_User.Gradex          = "Good";
                        obju_User.NICNo           = txt_nic.Text.Trim();
                        new U_UserxDL().Saveu_UserSP(obju_User, 3);


                        GetData();
                        txt_SalesmanID.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);
                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);
                    }
                }
                break;

            case xEnums.PerformanceType.Cancel:
                txt_SalesmanID.Enabled = true;
                FunctionButtonStatus(xEnums.PerformanceType.Default);
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Print:
                UserDefineMessages.ShowMsg1("Print still in process", UserDefineMessages.Msg_Information);
                break;
            }
        }
        private void performButtons(xEnums.PerformanceType xenum)
        {
            switch (xenum)
            {
            case xEnums.PerformanceType.View:

                if (ActiveControl.Name.Trim() == txt_VehicleID.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["VehicleFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["VehicleSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["VehicleField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                break;

            case xEnums.PerformanceType.New:
                FunctionButtonStatus(xEnums.PerformanceType.New);
                formMode = 1;
                txt_VehicleID.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Edit:
                FunctionButtonStatus(xEnums.PerformanceType.Edit);
                formMode = 3;
                txt_VehicleID.Enabled = false;
                txt_VehicleNo.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Save:
                errorProvider1.Clear();
                if (txt_VehicleNo.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_VehicleNo, "Please enter a vehicle number !");
                    return;
                }

                if (txt_VehicleID.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_VehicleID, "Please enter a vehicle ID !");
                    return;
                }


                if (incomingvehicle.Trim().ToUpper() != txt_VehicleNo.Text.Trim())
                {
                    if (M_VehicleDL.ExistingM_VehicleNo(txt_VehicleNo.Text.Trim()))
                    {
                        errorProvider1.SetError(txt_VehicleNo, "The vehicle number you have entered already exists!");
                        return;
                    }
                }

                if (formMode == 1)
                {
                    if (M_VehicleDL.ExistingM_Vehicle(txt_VehicleID.Text.Trim()))
                    {
                        errorProvider1.SetError(txt_VehicleID, "The vehicle code you have entered already exists!");
                        return;
                    }

                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        M_Vehicles objm_Vehicle = new M_Vehicles();
                        objm_Vehicle.VehicleID      = txt_VehicleID.Text.Trim();
                        objm_Vehicle.VehicleNo      = txt_VehicleNo.Text.Trim();
                        objm_Vehicle.CompCode       = commonFunctions.GlobalCompany;  //txt_CompCode.Text.Trim();
                        objm_Vehicle.Locacode       = commonFunctions.GlobalLocation; //txt_Locacode.Text.Trim();
                        objm_Vehicle.Make           = txt_Make.Text.Trim();
                        objm_Vehicle.Model          = txt_Model.Text.Trim();
                        objm_Vehicle.Driver         = txt_Driver.Text.Trim();
                        objm_Vehicle.Milage         = txt_Milage.Text.Trim();
                        objm_Vehicle.FuelEfficiency = commonFunctions.ToDecimal(txt_FuelEfficiency.Text.Trim());
                        objm_Vehicle.Status         = txt_Status.Text.Trim();
                        objm_Vehicle.Route          = txt_Route.Text.Trim();
                        objm_Vehicle.Userx          = commonFunctions.Loginuser; //txt_Userx.Text.Trim();
                        objm_Vehicle.Datex          = DateTime.Now;              //txt_Datex.Text.Trim();
                        M_VehicleDL bal = new M_VehicleDL();
                        bal.SaveM_VehicleSP(objm_Vehicle, 1);


                        GetData();

                        txt_VehicleID.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);
                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                    }
                }
                else if (formMode == 3)
                {
                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        M_Vehicles objm_Vehicle = new M_Vehicles();
                        objm_Vehicle.VehicleID      = txt_VehicleID.Text.Trim();
                        objm_Vehicle.VehicleNo      = txt_VehicleNo.Text.Trim();
                        objm_Vehicle.CompCode       = commonFunctions.GlobalCompany;  //txt_CompCode.Text.Trim();
                        objm_Vehicle.Locacode       = commonFunctions.GlobalLocation; //txt_Locacode.Text.Trim();
                        objm_Vehicle.Make           = txt_Make.Text.Trim();
                        objm_Vehicle.Model          = txt_Model.Text.Trim();
                        objm_Vehicle.Driver         = txt_Driver.Text.Trim();
                        objm_Vehicle.Milage         = txt_Milage.Text.Trim();
                        objm_Vehicle.FuelEfficiency = commonFunctions.ToDecimal(txt_FuelEfficiency.Text.Trim());
                        objm_Vehicle.Status         = txt_Status.Text.Trim();
                        objm_Vehicle.Route          = txt_Route.Text.Trim();
                        objm_Vehicle.Userx          = commonFunctions.Loginuser; //txt_Userx.Text.Trim();
                        objm_Vehicle.Datex          = DateTime.Now;              //txt_Datex.Text.Trim();
                        M_VehicleDL bal = new M_VehicleDL();
                        bal.SaveM_VehicleSP(objm_Vehicle, 3);


                        GetData();
                        txt_VehicleID.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);
                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);
                    }
                }
                break;

            case xEnums.PerformanceType.Cancel:
                txt_VehicleID.Enabled = true;
                FunctionButtonStatus(xEnums.PerformanceType.Default);
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Print:
                UserDefineMessages.ShowMsg1("Print still in process", UserDefineMessages.Msg_Information);
                break;
            }
        }
Beispiel #24
0
        private void performButtons(xEnums.PerformanceType xenum)
        {
            switch (xenum)
            {
            case xEnums.PerformanceType.View:

                if (ActiveControl.Name.Trim() == txt_AgentCode.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["AgentFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["AgentSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["AgentField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                break;

            case xEnums.PerformanceType.New:
                FunctionButtonStatus(xEnums.PerformanceType.New);
                formMode = 1;
                txt_AgentCode.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Edit:
                FunctionButtonStatus(xEnums.PerformanceType.Edit);
                formMode = 3;
                txt_AgentCode.Enabled = false;
                txt_Namex.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Save:
                errorProvider1.Clear();
                try
                {
                    if (txt_Namex.Text.Trim() == "")
                    {
                        errorProvider1.SetError(txt_Namex, "Please enter a agent name !");
                        return;
                    }
                    if (txt_AgentCode.Text.Trim() == "")
                    {
                        errorProvider1.SetError(txt_AgentCode, "Please enter a Agent Code !");
                        return;
                    }


                    if (formMode == 1)
                    {
                        if (M_AgentDL.ExistingM_Agent(txt_AgentCode.Text.Trim()))
                        {
                            errorProvider1.SetError(txt_AgentCode, "The agent code you have entered already exists!");
                            return;
                        }
                        if (!M_AreaDL.ExistingM_Area(txt_AreaCode.Text.Trim()))
                        {
                            errorProvider1.SetError(txt_AreaCode, "The area code you have entered already exists!");
                            return;
                        }



                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            M_Agents objm_Agent = new M_Agents();
                            objm_Agent.AgentCode  = txt_AgentCode.Text.Trim();
                            objm_Agent.Namex      = txt_Namex.Text.Trim();
                            objm_Agent.Address1   = txt_Address1.Text.Trim();
                            objm_Agent.Address2   = txt_Address2.Text.Trim();
                            objm_Agent.Address3   = txt_Address3.Text.Trim();
                            objm_Agent.TPOffice   = txt_TPOffice.Text.Trim();
                            objm_Agent.TPPersonal = txt_TPPersonal.Text.Trim();
                            objm_Agent.Fax        = txt_Fax.Text.Trim();
                            objm_Agent.Email      = txt_Email.Text.Trim();
                            objm_Agent.AccNo      = txt_AccNo.Text.Trim();
                            objm_Agent.NICno      = txt_NICno.Text.Trim();
                            objm_Agent.PassportNo = txt_PassportNo.Text.Trim();
                            objm_Agent.Datex      = DateTime.Now;              // txt_Datex.Text.Trim();
                            objm_Agent.userx      = commonFunctions.Loginuser; // txt_userx.Text.Trim();
                            objm_Agent.TimeFrom   = dte_from.Value;
                            objm_Agent.TimeTo     = dte_to.Value;
                            objm_Agent.District   = txt_AreaCode.Text;
                            objm_Agent.Remarks    = txt_remarks.Text;
                            M_AgentDL bal = new M_AgentDL();
                            bal.SaveM_AgentSP(objm_Agent, 1);


                            GetData();

                            txt_AgentCode.Enabled = true;
                            FunctionButtonStatus(xEnums.PerformanceType.Save);
                            commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                        }
                    }
                    else if (formMode == 3)
                    {
                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            M_Agents objm_Agent = new M_Agents();
                            objm_Agent.AgentCode  = txt_AgentCode.Text.Trim();
                            objm_Agent            = new M_AgentDL().Selectm_Agent(objm_Agent);
                            objm_Agent.Namex      = txt_Namex.Text.Trim();
                            objm_Agent.Address1   = txt_Address1.Text.Trim();
                            objm_Agent.Address2   = txt_Address2.Text.Trim();
                            objm_Agent.Address3   = txt_Address3.Text.Trim();
                            objm_Agent.TPOffice   = txt_TPOffice.Text.Trim();
                            objm_Agent.TPPersonal = txt_TPPersonal.Text.Trim();
                            objm_Agent.Fax        = txt_Fax.Text.Trim();
                            objm_Agent.Email      = txt_Email.Text.Trim();
                            objm_Agent.AccNo      = txt_AccNo.Text.Trim();
                            objm_Agent.NICno      = txt_NICno.Text.Trim();
                            objm_Agent.PassportNo = txt_PassportNo.Text.Trim();
                            objm_Agent.Datex      = DateTime.Now;              // txt_Datex.Text.Trim();
                            objm_Agent.userx      = commonFunctions.Loginuser; // txt_userx.Text.Trim();
                            objm_Agent.TimeFrom   = dte_from.Value;
                            objm_Agent.TimeTo     = dte_to.Value;
                            objm_Agent.District   = txt_AreaCode.Text;
                            objm_Agent.Remarks    = txt_remarks.Text;
                            M_AgentDL bal = new M_AgentDL();
                            bal.SaveM_AgentSP(objm_Agent, 3);


                            GetData();
                            txt_AgentCode.Enabled = true;
                            FunctionButtonStatus(xEnums.PerformanceType.Save);
                            commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                    commonFunctions.SetMDIStatusMessage("Genaral Error on updating data", 1);
                }
                break;

            case xEnums.PerformanceType.Cancel:
                txt_AgentCode.Enabled = true;
                FunctionButtonStatus(xEnums.PerformanceType.Default);
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Print:
                UserDefineMessages.ShowMsg1("Print still in process", UserDefineMessages.Msg_Information);
                break;
            }
        }
Beispiel #25
0
        private void performButtons(xEnums.PerformanceType xenum)
        {
            switch (xenum)
            {
            case xEnums.PerformanceType.View:

                if (ActiveControl.Name.Trim() == txt_AreaCode.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["AreaFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["AreaSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["AreaField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                break;

            case xEnums.PerformanceType.New:
                FunctionButtonStatus(xEnums.PerformanceType.New);
                formMode = 1;
                txt_AreaCode.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Edit:
                FunctionButtonStatus(xEnums.PerformanceType.Edit);
                formMode             = 3;
                txt_AreaCode.Enabled = false;
                txt_Descri.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Save:
                try
                {
                    if (txt_AreaCode.Text.Trim() == "")
                    {
                        errorProvider1.SetError(txt_AreaCode, "Please enter a area Code !");
                        return;
                    }
                    if (txt_Descri.Text.Trim() == "")
                    {
                        errorProvider1.SetError(txt_Descri, "Please enter a area name !");
                        return;
                    }
                    if (formMode == 1)
                    {
                        if (M_AreaDL.ExistingM_Area(txt_AreaCode.Text.Trim()))
                        {
                            errorProvider1.SetError(txt_AreaCode, "The area code you have entered already exists!");
                            return;
                        }



                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            M_Area objm_Area = new M_Area();
                            objm_Area.AreaCode = txt_AreaCode.Text.Trim();
                            objm_Area.Compcode = commonFunctions.GlobalCompany;  // txt_Compcode.Text.Trim();
                            objm_Area.Locacode = commonFunctions.GlobalLocation; // txt_Locacode.Text.Trim();
                            objm_Area.Descri   = txt_Descri.Text.Trim();
                            objm_Area.Datex    = DateTime.Now;                   //txt_Datex.Text.Trim();
                            objm_Area.Userx    = commonFunctions.Loginuser;      // txt_Userx.Text.Trim();
                            M_AreaDL bal = new M_AreaDL();
                            bal.SaveM_AreaSP(objm_Area, 1);



                            GetData();

                            txt_AreaCode.Enabled = true;
                            FunctionButtonStatus(xEnums.PerformanceType.Save);
                            UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Save_Sucess, commonFunctions.Softwarename.Trim());
                        }
                    }
                    else if (formMode == 3)
                    {
                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            M_Area objm_Area = new M_Area();
                            objm_Area.AreaCode = txt_AreaCode.Text.Trim();
                            objm_Area.Compcode = commonFunctions.GlobalCompany;  // txt_Compcode.Text.Trim();
                            objm_Area.Locacode = commonFunctions.GlobalLocation; // txt_Locacode.Text.Trim();
                            objm_Area.Descri   = txt_Descri.Text.Trim();
                            objm_Area.Datex    = DateTime.Now;                   //txt_Datex.Text.Trim();
                            objm_Area.Userx    = commonFunctions.Loginuser;      // txt_Userx.Text.Trim();
                            M_AreaDL bal = new M_AreaDL();
                            bal.SaveM_AreaSP(objm_Area, 3);

                            GetData();
                            txt_AreaCode.Enabled = true;
                            FunctionButtonStatus(xEnums.PerformanceType.Save);
                            UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_Update_Sucess, commonFunctions.Softwarename.Trim());
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                    commonFunctions.SetMDIStatusMessage("Genaral Error on updating data", 1);
                }

                break;

            case xEnums.PerformanceType.Cancel:
                txt_AreaCode.Enabled = true;
                FunctionButtonStatus(xEnums.PerformanceType.Default);
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Print:
                UserDefineMessages.ShowMsg1("Print still in process", UserDefineMessages.Msg_Information);
                break;
            }
        }
        private void performButtons(xEnums.PerformanceType xenum)
        {
            switch (xenum)
            {
            case xEnums.PerformanceType.View:

                if (ActiveControl.Name.Trim() == txt_SupID.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["SupplierFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["SupplierSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["SupplierField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                break;

            case xEnums.PerformanceType.New:
                FunctionButtonStatus(xEnums.PerformanceType.New);
                //txt_IDX.Text = commonFunctions.GetSerial("A0009");
                formMode = 1;
                txt_SupID.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Edit:
                FunctionButtonStatus(xEnums.PerformanceType.Edit);
                formMode          = 3;
                txt_SupID.Enabled = false;
                txt_suppName.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Save:


                if (txt_suppName.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_suppName, "Please enter a supplier name !");
                    return;
                }

                if (txt_SupID.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_SupID, "Please enter a supplier code !");
                    commonFunctions.SetMDIStatusMessage("Please enter a supplier code.", 1);
                    return;
                }


                if (formMode == 1)
                {
                    if (M_SupplierDL.ExistingM_Supplier(txt_SupID.Text.Trim()))
                    {
                        errorProvider1.SetError(txt_SupID, "The supplier code you have entered already exists!");
                        return;
                    }



                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        M_Suppliers objm_Supplier = new M_Suppliers();
                        objm_Supplier.SupID           = txt_SupID.Text.Trim();
                        objm_Supplier.suppName        = txt_suppName.Text.Trim();
                        objm_Supplier.CompCode        = commonFunctions.GlobalCompany;
                        objm_Supplier.Locacode        = commonFunctions.GlobalLocation;
                        objm_Supplier.TP              = txt_TP.Text.Trim();
                        objm_Supplier.Fax             = txt_Fax.Text.Trim();
                        objm_Supplier.Email           = txt_Email.Text.Trim();
                        objm_Supplier.Address1        = txt_Address1.Text.Trim();
                        objm_Supplier.Address2        = txt_Address2.Text.Trim();
                        objm_Supplier.Address3        = txt_Address3.Text.Trim();
                        objm_Supplier.ContactPerson   = txt_ContactPerson.Text.Trim();
                        objm_Supplier.ContactPersonNo = txt_ContactPersonNo.Text.Trim();
                        objm_Supplier.CurrentStatus   = "";
                        M_SupplierDL bal = new M_SupplierDL();
                        bal.SaveM_SupplierSP(objm_Supplier, 1);

                        GetData();

                        txt_SupID.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);
                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                    }
                }
                else if (formMode == 3)
                {
                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        M_Suppliers objm_Supplier = new M_Suppliers();
                        objm_Supplier.SupID           = txt_SupID.Text.Trim();
                        objm_Supplier.suppName        = txt_suppName.Text.Trim();
                        objm_Supplier.CompCode        = commonFunctions.GlobalCompany;
                        objm_Supplier.Locacode        = commonFunctions.GlobalLocation;
                        objm_Supplier.TP              = txt_TP.Text.Trim();
                        objm_Supplier.Fax             = txt_Fax.Text.Trim();
                        objm_Supplier.Email           = txt_Email.Text.Trim();
                        objm_Supplier.Address1        = txt_Address1.Text.Trim();
                        objm_Supplier.Address2        = txt_Address2.Text.Trim();
                        objm_Supplier.Address3        = txt_Address3.Text.Trim();
                        objm_Supplier.ContactPerson   = txt_ContactPerson.Text.Trim();
                        objm_Supplier.ContactPersonNo = txt_ContactPersonNo.Text.Trim();
                        objm_Supplier.CurrentStatus   = "";
                        M_SupplierDL bal = new M_SupplierDL();
                        bal.SaveM_SupplierSP(objm_Supplier, 3);


                        GetData();
                        txt_SupID.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);

                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);
                    }
                }
                break;

            case xEnums.PerformanceType.Cancel:
                txt_SupID.Enabled = true;
                FunctionButtonStatus(xEnums.PerformanceType.Default);
                errorProvider1.Clear();


                break;

            case xEnums.PerformanceType.Print:
                if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Prnt, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                {
                    string          reporttitle = "List of All suppliers".ToUpper();
                    frm_reportViwer rpt         = new frm_reportViwer();
                    rpt.MdiParent      = MDI_SMartAnything.ActiveForm;
                    rpt.FormHeadertext = reporttitle;

                    ParameterField  paramField  = new ParameterField();
                    ParameterFields paramFields = new ParameterFields();

                    paramFields = commonFunctions.AddCrystalParams(reporttitle, commonFunctions.Loginuser.ToUpper());

                    string str = "SELECT * FROM M_Suppliers";

                    rpt_m_suppliers rptBank = new rpt_m_suppliers();
                    rptBank.SetDataSource(commonFunctions.GetDatatable(str));
                    rpt.RepViewer.ParameterFieldInfo = paramFields;
                    rpt.RepViewer.ReportSource       = rptBank;
                    rpt.RepViewer.Refresh();
                    rpt.Show();
                }

                break;
            }
        }
Beispiel #27
0
        private void performButtons(xEnums.PerformanceType xenum)
        {
            switch (xenum)
            {
            case xEnums.PerformanceType.View:

                if (ActiveControl.Name.Trim() == txt_Routecode.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["RouteFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["RouteSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["RouteField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                break;

            case xEnums.PerformanceType.New:
                FunctionButtonStatus(xEnums.PerformanceType.New);
                formMode = 1;
                txt_Routecode.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Edit:
                FunctionButtonStatus(xEnums.PerformanceType.Edit);
                formMode = 3;
                txt_Routecode.Enabled = false;
                txt_Descr.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Save:
                errorProvider1.Clear();
                if (txt_Descr.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_Descr, "Please enter a route name !");
                    return;
                }
                if (txt_Routecode.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_Routecode, "Please enter a route code !");
                    return;
                }
                if (formMode == 1)
                {
                    if (M_RouteDL.ExistingM_Route(txt_Routecode.Text.Trim()))
                    {
                        errorProvider1.SetError(txt_Routecode, "The route code you have entered already exists!");
                        return;
                    }

                    if (!M_AreaDL.ExistingM_Area(txt_AreaCode.Text.Trim()))
                    {
                        errorProvider1.SetError(txt_AreaCode, "The area code you have entered not exists!");
                        return;
                    }

                    if (!M_TerritoryDL.ExistingM_Territory(txt_TerritoryCode.Text.Trim()))
                    {
                        errorProvider1.SetError(txt_TerritoryCode, "The territory code you have entered not exists!");
                        return;
                    }



                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        M_Route objm_Route = new M_Route();
                        objm_Route.Routecode     = txt_Routecode.Text.Trim();
                        objm_Route.Compcode      = commonFunctions.GlobalCompany;  //txt_Compcode.Text.Trim();
                        objm_Route.Locacode      = commonFunctions.GlobalLocation; //txt_Locacode.Text.Trim();
                        objm_Route.TerritoryCode = txt_TerritoryCode.Text.Trim();
                        objm_Route.AreaCode      = txt_AreaCode.Text.Trim();
                        objm_Route.Descr         = txt_Descr.Text.Trim();
                        objm_Route.Datex         = DateTime.Now;
                        objm_Route.Userx         = commonFunctions.Loginuser;
                        M_RouteDL bal = new M_RouteDL();
                        bal.SaveM_RouteSP(objm_Route, 1);

                        GetData();

                        txt_TerritoryCode.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);
                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                    }
                }
                else if (formMode == 3)
                {
                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        M_Route objm_Route = new M_Route();
                        objm_Route.Routecode     = txt_Routecode.Text.Trim();
                        objm_Route.Compcode      = commonFunctions.GlobalCompany;  //txt_Compcode.Text.Trim();
                        objm_Route.Locacode      = commonFunctions.GlobalLocation; //txt_Locacode.Text.Trim();
                        objm_Route.TerritoryCode = txt_TerritoryCode.Text.Trim();
                        objm_Route.AreaCode      = txt_AreaCode.Text.Trim();
                        objm_Route.Descr         = txt_Descr.Text.Trim();
                        objm_Route.Datex         = DateTime.Now;
                        objm_Route.Userx         = commonFunctions.Loginuser;
                        M_RouteDL bal = new M_RouteDL();
                        bal.SaveM_RouteSP(objm_Route, 3);


                        GetData();
                        txt_TerritoryCode.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);

                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);
                    }
                }
                break;

            case xEnums.PerformanceType.Cancel:
                txt_TerritoryCode.Enabled = true;
                FunctionButtonStatus(xEnums.PerformanceType.Default);
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Print:
                UserDefineMessages.ShowMsg1("Print still in process", UserDefineMessages.Msg_Information);
                break;
            }
        }
        private void performButtons(xEnums.PerformanceType xenum)
        {
            switch (xenum)
            {
            case xEnums.PerformanceType.View:

                if (ActiveControl.Name.Trim() == txt_ID.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["AreaFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["AreaSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["AreaField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                break;

            case xEnums.PerformanceType.New:
                FunctionButtonStatus(xEnums.PerformanceType.New);
                formMode = 1;
                txt_ID.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Edit:
                FunctionButtonStatus(xEnums.PerformanceType.Edit);
                formMode       = 3;
                txt_ID.Enabled = false;
                txt_Reason.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Save:
                try
                {
                    if (txt_ID.Text.Trim() == "")
                    {
                        errorProvider1.SetError(txt_ID, "Please enter a credit note code !");
                        return;
                    }

                    if (txt_Reason.Text.Trim() == "")
                    {
                        errorProvider1.SetError(txt_Reason, "Please enter a subcategory name !");
                        return;
                    }
                    if (formMode == 1)
                    {
                        if (M_CNReasonDL.ExistingM_CNReason(txt_ID.Text.Trim()))
                        {
                            errorProvider1.SetError(txt_ID, "The credit note reason you have entered already exists!");
                            return;
                        }

                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            M_CNReason objm_CNReason = new M_CNReason();
                            objm_CNReason.ID                = txt_ID.Text.Trim();
                            objm_CNReason.Reason            = txt_Reason.Text.Trim();
                            objm_CNReason.NeedToUpdateStock = Chk_NeedToUpdateStock.Checked;
                            objm_CNReason.StockType         = comboBox1.Text.Trim();
                            objm_CNReason.UserCode          = commonFunctions.Loginuser;
                            objm_CNReason.Datex             = DateTime.Now;
                            new M_CNReasonDL().Savem_CNReasonSP(objm_CNReason, 1);



                            GetData();

                            txt_ID.Enabled = true;
                            FunctionButtonStatus(xEnums.PerformanceType.Save);
                            commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                        }
                    }
                    else if (formMode == 3)
                    {
                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            M_CNReason objm_CNReason = new M_CNReason();
                            objm_CNReason.ID                = txt_ID.Text.Trim();
                            objm_CNReason.Reason            = txt_Reason.Text.Trim();
                            objm_CNReason.NeedToUpdateStock = Chk_NeedToUpdateStock.Checked;
                            objm_CNReason.StockType         = comboBox1.Text.Trim();
                            objm_CNReason.UserCode          = commonFunctions.Loginuser;
                            objm_CNReason.Datex             = DateTime.Now;
                            new M_CNReasonDL().Savem_CNReasonSP(objm_CNReason, 3);

                            GetData();
                            txt_ID.Enabled = true;
                            FunctionButtonStatus(xEnums.PerformanceType.Save);

                            commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                    commonFunctions.SetMDIStatusMessage("Genaral Error on updating data", 1);
                }

                break;

            case xEnums.PerformanceType.Cancel:
                txt_ID.Enabled = true;
                FunctionButtonStatus(xEnums.PerformanceType.Default);
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Print:
                UserDefineMessages.ShowMsg1("Print still in process", UserDefineMessages.Msg_Information);
                break;
            }
        }
Beispiel #29
0
        private void performButtons(xEnums.PerformanceType xenum)
        {
            switch (xenum)
            {
            case xEnums.PerformanceType.View:

                if (ActiveControl.Name.Trim() == txt_comcode.Name.Trim())
                {
                    int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["BankFieldLength"]);
                    string[] strSearchField = new string[length];

                    string strSQL = ConfigurationManager.AppSettings["BankSQL"].ToString();

                    for (int i = 0; i < length; i++)
                    {
                        string m;
                        m = i.ToString();
                        strSearchField[i] = ConfigurationManager.AppSettings["BankField" + m + ""].ToString();
                    }

                    frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                    find.ShowDialog(this);
                }

                break;

            case xEnums.PerformanceType.New:
                FunctionButtonStatus(xEnums.PerformanceType.New);
                formMode = 1;
                txt_comcode.Focus();
                break;

            case xEnums.PerformanceType.Edit:
                FunctionButtonStatus(xEnums.PerformanceType.Edit);
                formMode = 3;
                txt_name.Focus();
                break;

            case xEnums.PerformanceType.Save:
                try
                {
                    if (formMode == 1)
                    {
                        if (M_CompanyDL.ExistingBank(txt_comcode.Text.Trim()))
                        {
                            UserDefineMessages.ShowMsg("The company code you have entered already exists!", UserDefineMessages.Msg_Warning);
                            return;
                        }

                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            M_Company objbank = new M_Company();
                            objbank.CompCode = txt_comcode.Text.Trim();
                            objbank.Descr    = txt_name.Text.Trim().ToUpper();
                            objbank.Add1     = txt_add1.Text.Trim();
                            objbank.Add2     = txt_add2.Text.Trim();
                            objbank.Add3     = txt_add3.Text.Trim();
                            objbank.Datex    = DateTime.Now;
                            objbank.Emailx   = txt_email.Text.Trim();
                            objbank.Fax      = txt_fax.Text.Trim();
                            objbank.Tpno     = txt_tp.Text.Trim();
                            objbank.Userx    = commonFunctions.Loginuser;


                            M_CompanyDL bal = new M_CompanyDL();
                            bal.SaveBankSP(objbank, 1);
                            GetData();
                            FunctionButtonStatus(xEnums.PerformanceType.Save);
                            commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                        }
                    }
                    else if (formMode == 3)
                    {
                        if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                        {
                            M_Company objbank = new M_Company();
                            objbank.CompCode = txt_comcode.Text.Trim();
                            objbank.Descr    = txt_name.Text.Trim().ToUpper();
                            objbank.Add1     = txt_add1.Text.Trim();
                            objbank.Add2     = txt_add2.Text.Trim();
                            objbank.Add3     = txt_add3.Text.Trim();
                            objbank.Datex    = DateTime.Now;
                            objbank.Emailx   = txt_email.Text.Trim();
                            objbank.Fax      = txt_fax.Text.Trim();
                            objbank.Tpno     = txt_tp.Text.Trim();
                            objbank.Userx    = commonFunctions.Loginuser;


                            M_CompanyDL bal = new M_CompanyDL();
                            bal.SaveBankSP(objbank, 3);
                            GetData();
                            FunctionButtonStatus(xEnums.PerformanceType.Save);

                            commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception");
                    commonFunctions.SetMDIStatusMessage("Genaral Error on loading data", 1);
                }

                break;

            case xEnums.PerformanceType.Cancel:
                FunctionButtonStatus(xEnums.PerformanceType.Default);
                break;

            case xEnums.PerformanceType.Print:
                UserDefineMessages.ShowMsg1("Print still in process", UserDefineMessages.Msg_Information);
                break;
            }
        }
Beispiel #30
0
        private void txt_docno_KeyDown(object sender, KeyEventArgs e)
        {
            errorProvider1.Clear();
            if (e.KeyCode == Keys.Enter)
            {
                //txt_Customer_name.Text = findExisting.FindExisitingCUstomer(txt_Customer.Text);
            }
            if (e.KeyCode == Keys.F2)
            {
                if (rdo_inv.Checked)
                {
                    if (ActiveControl.Name.Trim() == txt_docno.Name.Trim())
                    {
                        int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["InvoiceFieldLength"]);
                        string[] strSearchField = new string[length];
                        string   strSQL         = ConfigurationManager.AppSettings["InvoiceSQLProcessed"].ToString();
                        for (int i = 0; i < length; i++)
                        {
                            string m;
                            m = i.ToString();
                            strSearchField[i] = ConfigurationManager.AppSettings["InvoiceField" + m + ""].ToString();
                        }
                        frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                        find.ShowDialog(this);
                    }
                }
                if (rdo_rec.Checked)
                {
                    if (ActiveControl.Name.Trim() == txt_docno.Name.Trim())
                    {
                        int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["ReceiptFieldLength"]);
                        string[] strSearchField = new string[length];
                        string   strSQL         = ConfigurationManager.AppSettings["ReceiptSQLProcessed"].ToString();
                        for (int i = 0; i < length; i++)
                        {
                            string m;
                            m = i.ToString();
                            strSearchField[i] = ConfigurationManager.AppSettings["ReceiptField" + m + ""].ToString();
                        }
                        frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                        find.ShowDialog(this);
                    }
                }

                if (rdo_order.Checked)
                {
                    if (ActiveControl.Name.Trim() == txt_docno.Name.Trim())
                    {
                        int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["OrderFormReportsFieldLength"]);
                        string[] strSearchField = new string[length];
                        string   strSQL         = ConfigurationManager.AppSettings["OrderFormReportsUSSQL"].ToString();
                        for (int i = 0; i < length; i++)
                        {
                            string m;
                            m = i.ToString();
                            strSearchField[i] = ConfigurationManager.AppSettings["OrderFormReportsField" + m + ""].ToString();
                        }
                        frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                        find.ShowDialog(this);
                    }
                }
                if (rdo_do.Checked)
                {
                    if (ActiveControl.Name.Trim() == txt_docno.Name.Trim())
                    {
                        int      length         = Convert.ToInt32(ConfigurationManager.AppSettings["DOFieldLength"]);
                        string[] strSearchField = new string[length];
                        string   strSQL         = ConfigurationManager.AppSettings["DOSQL"].ToString();
                        for (int i = 0; i < length; i++)
                        {
                            string m;
                            m = i.ToString();
                            strSearchField[i] = ConfigurationManager.AppSettings["DOField" + m + ""].ToString();
                        }
                        frmU_Search find = new frmU_Search(strSQL, strSearchField, this);
                        find.ShowDialog(this);
                    }
                }
            }
        }