Esempio n. 1
0
 private void SetValues(String sm_Agent)
 {
     try
     {
         M_AgentDL objm_AgentDL = new M_AgentDL();
         M_Agents  objm_Agent   = new M_Agents();
         if (sm_Agent != "")
         {
             objm_Agent.AgentCode = sm_Agent;
             objm_Agent           = objm_AgentDL.Selectm_Agent(objm_Agent);
             if (objm_Agent != null)
             {
                 txt_AgentCode.Text  = objm_Agent.AgentCode.ToString();
                 txt_Namex.Text      = objm_Agent.Namex.ToString();
                 txt_Address1.Text   = objm_Agent.Address1.ToString();
                 txt_Address2.Text   = objm_Agent.Address2.ToString();
                 txt_Address3.Text   = objm_Agent.Address3.ToString();
                 txt_TPOffice.Text   = objm_Agent.TPOffice.ToString();
                 txt_TPPersonal.Text = objm_Agent.TPPersonal.ToString();
                 txt_Fax.Text        = objm_Agent.Fax.ToString();
                 txt_Email.Text      = objm_Agent.Email.ToString();
                 txt_AccNo.Text      = objm_Agent.AccNo.ToString();
                 txt_NICno.Text      = objm_Agent.NICno.ToString();
                 txt_PassportNo.Text = objm_Agent.PassportNo.ToString();
                 txt_remarks.Text    = objm_Agent.Remarks;
                 txt_AreaCode.Text   = objm_Agent.District;
                 formMode            = 0;
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void btn_hanoverdo_Click(object sender, EventArgs e)
        {
            //lbl_message.Text = "";
            errorProvider1.Clear();
            if (head.Handedover == 1)
            {
                errorProvider1.SetError(btn_hanoverdo, "This delivery order already handovered.".ToUpper());
                commonFunctions.SetMDIStatusMessage("This delivery order already handovered.", 1);
                return;
            }

            if (head.Dispatched == 0)
            {
                errorProvider1.SetError(btn_hanoverdo, "This delivery order is not dispatched.".ToUpper());
                commonFunctions.SetMDIStatusMessage("This delivery order is not dispatched.", 1);
                return;
            }

            //if (!M_VehicleDL.ExistingM_Vehicle(txt_Lorry.Text.Trim()))
            //{
            //    errorProvider1.SetError(txt_Lorry, "Vehicle details does not exists on the system ");
            //    commonFunctions.SetMDIStatusMessage("Vehicle details does not exists on the system ", 1);
            //    return;
            //}
            if (!M_AgentDL.ExistingM_Agent(txt_Agent.Text.Trim()))
            {
                errorProvider1.SetError(txt_Agent, "Agent does not exists on the system ");
                commonFunctions.SetMDIStatusMessage("Agent does not exists on the system ", 1);
                return;
            }

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

                cat          = new T_DIliveryHed();
                cat.DoNo     = head.DONo.Trim();
                cat.LocaCode = commonFunctions.GlobalLocation;
                cat          = new T_DIliveryHedDL().Selectt_DIliveryHed(cat, 1);


                cat.Handovered     = 1;
                cat.HandoverDate   = DateTime.Now;
                cat.HandoverdUser  = commonFunctions.Loginuser;
                head.HandOverLorry = txt_Lorry.Text.Trim();

                head.Handedover     = 1;
                head.HandedoverDate = DateTime.Now;
                head.HandedoverUser = commonFunctions.Loginuser;


                if (dl.Savet_DIliveryHedSP(cat, 3) && new T_OrderTrackingDL().Savet_OrderTrackingSP(head, 3))
                {
                    commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                }
                getProcessedOFs();
            }
        }
Esempio n. 3
0
        private void GetData()
        {
            try
            {
                M_AgentDL bdl = new M_AgentDL();
                dataGridView1.DataSource = bdl.SelectAllm_Agent();

                if (dataGridView1.DataSource != null)
                {
                    dataGridView1.Columns[0].Width = 120;
                    dataGridView1.Columns[1].Width = 585;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        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);
                }
            }
        }
Esempio n. 5
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;
            }
        }