Exemplo n.º 1
0
        protected void BinDAgentInfo()
        {
            AgentInfoData agent = new AgentInfoData();

            DS = agent.GetAllAgentDetails();
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                int count = Convert.ToInt32(DS.Tables[1].Rows[0]["id"]);
                count = count + 1;
                //txtAgentCode.Text = string.Format("A{0:0000}", count++);
                rpAgentINfo.DataSource = DS;
                rpAgentINfo.DataBind();
            }
        }
Exemplo n.º 2
0
        public void AddAgentShemeDetails(int dbagentinfo)
        {
            AgentInfoData agentInfoData = new AgentInfoData();
            DataSet       DS            = new DataSet();

            DS = agentInfoData.GetAgentbyID(dbagentinfo);
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                //txtSchemeAmount.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["SchemeAmount"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["SchemeAmount"].ToString();
                Invoice     invocie    = new Invoice();
                InvoiceData invicedata = new InvoiceData();
                invocie.TokanId           = hftokanno.Value;
                invocie.UserID            = GlobalInfo.Userid;
                invocie.TypeID            = 0;
                invocie.ProductID         = 0;
                invocie.qty               = 0;
                invocie.totalCoast        = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["SchemeAmount"].ToString()) ? 0 : Convert.ToDouble(DS.Tables[0].Rows[0]["SchemeAmount"]);
                invocie.SchemeAmount      = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["SchemeAmount"].ToString()) ? 0 : Convert.ToDouble(DS.Tables[0].Rows[0]["SchemeAmount"]);
                invocie.TotalSchemeAmount = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["TotalSchemeAmount"].ToString()) ? 0 : Convert.ToDouble(DS.Tables[0].Rows[0]["TotalSchemeAmount"]);
                invocie.TotalSchemeAmount = invocie.TotalSchemeAmount + invocie.SchemeAmount;
                schemeTemp = invocie.TotalSchemeAmount;

                if (invocie.SchemeAmount > 0)
                {
                    schemeApplied = true;
                    invicedata.Booth_InsertTempInvoiceItam(invocie);
                    BindAgntTempItam(invocie);
                }
                else
                {
                    schemeApplied = false;
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Scheme not available')", true);
                    dpAgentShemeApplied.ClearSelection();
                }
            }
        }
Exemplo n.º 3
0
        public void GetAgentbyID(int dbagentinfo)
        {
            txtAgentCode.Enabled = true;
            AgentInfoData agentInfoData = new AgentInfoData();
            DataSet       DS            = new DataSet();

            DS = agentInfoData.GetAgentbyID(dbagentinfo);
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                txtAgentCode.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["AgentCode"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["AgentCode"].ToString();
                dpRoute.ClearSelection();
                if (dpRoute.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["RouteID"]).ToString()) != null)
                {
                    dpRoute.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["RouteID"]).ToString()).Selected = true;
                }
                txtAgentName.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["AgentName"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["AgentName"].ToString();
                //string DateofJoining = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["DateofJoining"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["DateofJoining"].ToString();
                //if (!string.IsNullOrEmpty(DateofJoining))
                //{
                //    txtDateOfJoing.Text = (Convert.ToDateTime(DateofJoining).ToString("yyyy-MM-dd"));
                //}
                string DateofJoiningstring = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["DateofJoining"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["DateofJoining"].ToString();
                //sky
                DateTime date1 = Convert.ToDateTime(DateofJoiningstring, System.Globalization.CultureInfo.GetCultureInfo("ur-PK").DateTimeFormat);
                txtDateOfJoing.Text = (Convert.ToDateTime(date1).ToString("yyyy-MM-dd"));

                txtApprovedBy.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["AppriveBy"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["AppriveBy"].ToString();
                dpStatus.ClearSelection();
                if (DS.Tables[0].Rows[0]["Isactive"].ToString() == "True")
                {
                    dpStatus.Items.FindByValue("1").Selected = true;
                }
                if (DS.Tables[0].Rows[0]["Isactive"].ToString() == "False")
                {
                    dpStatus.Items.FindByValue("2").Selected = true;
                }
                //dpEmployeeID.ClearSelection();
                //if (dpEmployeeID.Items.FindByValue(DS.Tables[0].Rows[0]["EmployeeID"].ToString()) != null)
                //{
                //    dpEmployeeID.Items.FindByValue(DS.Tables[0].Rows[0]["EmployeeID"].ToString()).Selected = true;
                //}
                dpAgencyType.ClearSelection();
                if (dpAgencyType.Items.FindByText(DS.Tables[0].Rows[0]["Agensytype"].ToString()) != null)
                {
                    dpAgencyType.Items.FindByText(DS.Tables[0].Rows[0]["Agensytype"].ToString()).Selected = true;
                }

                txtAddress1.Text  = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Address1"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Address1"].ToString();
                txtAddress2.Text  = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Address2"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Address2"].ToString();
                txtAddress3.Text  = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Address2"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Address2"].ToString();
                txtEmail.Text     = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Email"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Email"].ToString();
                txtTelephone.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["TelephoneNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["TelephoneNo"].ToString();
                txtMobile.Text    = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["MobileNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["MobileNo"].ToString();
                //dpDistrict.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Districk"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Districk"].ToString();
                //txtCity.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["City"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["City"].ToString();
                dpDistric.ClearSelection();
                if (dpDistric.Items.FindByText(DS.Tables[0].Rows[0]["Districk"].ToString()) != null)
                {
                    dpDistric.Items.FindByText(DS.Tables[0].Rows[0]["Districk"].ToString()).Selected = true;
                }
                dpCity.ClearSelection();
                if (dpCity.Items.FindByText(DS.Tables[0].Rows[0]["City"].ToString()) != null)
                {
                    dpCity.Items.FindByText(DS.Tables[0].Rows[0]["City"].ToString()).Selected = true;
                }
                dpState.ClearSelection();
                if (dpState.Items.FindByText(DS.Tables[0].Rows[0]["State"].ToString()) != null)
                {
                    dpState.Items.FindByText(DS.Tables[0].Rows[0]["State"].ToString()).Selected = true;
                }
                dpCountry.ClearSelection();
                if (dpCountry.Items.FindByText(DS.Tables[0].Rows[0]["Country"].ToString()) != null)
                {
                    dpCountry.Items.FindByText(DS.Tables[0].Rows[0]["Country"].ToString()).Selected = true;
                }

                dpbillingtype.ClearSelection();
                if (dpbillingtype.Items.FindByText(DS.Tables[0].Rows[0]["BillingMethod"].ToString()) != null)
                {
                    dpbillingtype.Items.FindByText(DS.Tables[0].Rows[0]["BillingMethod"].ToString()).Selected = true;
                }
                dppaymenttype.ClearSelection();
                if (dppaymenttype.Items.FindByText(DS.Tables[0].Rows[0]["PaymentMode"].ToString()) != null)
                {
                    dppaymenttype.Items.FindByText(DS.Tables[0].Rows[0]["PaymentMode"].ToString()).Selected = true;
                }
                txtDepositeAmount.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["DepositeAmount"].ToString()) ? string.Empty : string.Format("{0:0.#####}", DS.Tables[0].Rows[0]["DepositeAmount"].ToString());
                dpBankName.ClearSelection();
                if (dpBankName.Items.FindByText(DS.Tables[0].Rows[0]["BankName"].ToString()) != null)
                {
                    dpBankName.Items.FindByText(DS.Tables[0].Rows[0]["BankName"].ToString()).Selected = true;
                }
                //txtBankName.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Bankname"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Bankname"].ToString();
                txtAccountNo.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["AccountNo"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["AccountNo"].ToString();
                dpAccountType.ClearSelection();
                if (dpAccountType.Items.FindByText(DS.Tables[0].Rows[0]["AccountType"].ToString()) != null)
                {
                    dpAccountType.Items.FindByText(DS.Tables[0].Rows[0]["AccountType"].ToString()).Selected = true;
                }

                // txtIfscCode.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["IFScode"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["IFScode"].ToString();
                dpIfscCode.ClearSelection();
                if (dpIfscCode.Items.FindByText(DS.Tables[0].Rows[0]["IFScode"].ToString()) != null)
                {
                    dpIfscCode.Items.FindByText(DS.Tables[0].Rows[0]["IFScode"].ToString()).Selected = true;
                }


                txtValoume.Text   = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Volume"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Volume"].ToString();
                txtNoOfTrays.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["NoTrays"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["NoTrays"].ToString();
                dpDoorToDoor.ClearSelection();
                if (DS.Tables[0].Rows[0]["DoorToDoor"].ToString() == "True")
                {
                    dpDoorToDoor.Items.FindByValue("1").Selected = true;
                }
                if (DS.Tables[0].Rows[0]["DoorToDoor"].ToString() == "False")
                {
                    dpDoorToDoor.Items.FindByValue("2").Selected = true;
                }

                if (DS.Tables[0].Rows[0]["FreezerAvailable"].ToString() == "True")
                {
                    rbcFreezerYes.Checked = true;
                }
                if (DS.Tables[0].Rows[0]["FreezerAvailable"].ToString() == "False")
                {
                    rbcFreezerNo.Checked = true;
                }


                if (DS.Tables[0].Rows[0]["FreezerRetrun"].ToString() == "True")
                {
                    rbFreezerRestrunYes.Checked = true;
                }
                if (DS.Tables[0].Rows[0]["FreezerRetrun"].ToString() == "False")
                {
                    rbFreezerRestrunNo.Checked = true;
                }

                // string Deactivedate = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Deactivedate"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Deactivedate"].ToString();


                if (DS.Tables[0].Rows[0]["Deactivedate"].ToString() == "")
                {
                    txtDeactivedate.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Deactivedate"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Deactivedate"].ToString();
                }
                else
                {
                    string DateofDeactivation = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Deactivedate"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Deactivedate"].ToString();
                    //sky
                    DateTime date2 = Convert.ToDateTime(DateofDeactivation, System.Globalization.CultureInfo.GetCultureInfo("ur-PK").DateTimeFormat);
                    txtDeactivedate.Text = (Convert.ToDateTime(date2).ToString("yyyy-MM-dd"));
                }
                txtDeactiveRession.Text   = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["DeactiveReason"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["DeactiveReason"].ToString();
                txtAmountRetrun.Text      = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["AmountReturned"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["AmountReturned"].ToString();
                txtTraysReturned.Text     = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["TraysReturned"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["TraysReturned"].ToString();
                txtSchemeAmount.Text      = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["SchemeAmount"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["SchemeAmount"].ToString();
                txtSchemeTotalAmount.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["TotalSchemeAmount"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["TotalSchemeAmount"].ToString();
            }
        }
Exemplo n.º 4
0
        public void DeleteAgentbyID(int AgentId)
        {
            AgentInfo     agentInfo = new AgentInfo();
            AgentInfoData agentData = new AgentInfoData();
            int           Result    = 0;

            agentInfo.AgentID       = Convert.ToInt32(hfAgentID.Value);
            agentInfo.AgentCode     = string.Empty;
            agentInfo.RouteID       = 0;
            agentInfo.AgentName     = string.Empty;
            agentInfo.DateofJoining = string.Empty;
            agentInfo.AppriveBy     = string.Empty;
            if (dpStatus.SelectedItem.Value == "1")
            {
                agentInfo.Status = true;
            }
            if (dpStatus.SelectedItem.Value == "2")
            {
                agentInfo.Status = true;
            }
            //agentInfo.EmployeeID = 0;
            agentInfo.Agensytype    = string.Empty;
            agentInfo.Address1      = string.Empty;
            agentInfo.Address2      = string.Empty;
            agentInfo.Address3      = string.Empty;
            agentInfo.Email         = string.Empty;
            agentInfo.TelephoneNo   = string.Empty;
            agentInfo.MobileNo      = string.Empty;
            agentInfo.Districk      = string.Empty;
            agentInfo.City          = string.Empty;
            agentInfo.State         = string.Empty;
            agentInfo.Country       = string.Empty;
            agentInfo.BillingMethod = string.Empty;
            agentInfo.PaymentType   = string.Empty;
            agentInfo.DepositAmount = 0;
            agentInfo.BankName      = string.Empty;
            agentInfo.AccounNo      = string.Empty;
            agentInfo.AccountType   = string.Empty;
            agentInfo.IFSCCode      = string.Empty;
            agentInfo.Volume        = string.Empty;
            agentInfo.NoofTrays     = 0;

            agentInfo.DoortoDoor = false;

            agentInfo.FreezerAvailable = false;

            agentInfo.Deactivedate      = string.Empty;
            agentInfo.DeactiveReason    = string.Empty;
            agentInfo.AmountReturned    = 0;
            agentInfo.TraysReturned     = 0;
            agentInfo.SchemeAmount      = 0; // string.IsNullOrEmpty(txtAmountRetrun.Text) ? 0 : Convert.ToDouble(txtSchemeAmount.Text);
            agentInfo.SchemeTotalAmount = 0; // string.IsNullOrEmpty(txtAmountRetrun.Text) ? 0 : Convert.ToDouble(txtSchemeAmountShemeTotalAmount.Text);
            agentInfo.IsArchive         = true;
            agentInfo.CreatedBy         = GlobalInfo.Userid;
            agentInfo.Createddate       = DateTime.Now.ToString("dd-MM-yyyy");
            agentInfo.ModifiedBy        = GlobalInfo.Userid;
            agentInfo.ModifiedDate      = DateTime.Now.ToString("dd-MM-yyyy");
            agentInfo.flag = "Delete";
            Result         = agentData.InsertAgentInfo(agentInfo);
            if (Result > 0)
            {
                divDanger.Visible      = false;
                divwarning.Visible     = false;
                divSusccess.Visible    = true;
                lblSuccess.Text        = "Agent Delete  Successfully";
                btnAddagent.Visible    = true;
                btnupdateagent.Visible = false;
                BinDAgentInfo();
                pnlError.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Exemplo n.º 5
0
        protected void btnUpdate_click(object sender, EventArgs e)
        {
            AgentInfo     agentInfo = new AgentInfo();
            AgentInfoData agentData = new AgentInfoData();
            int           Result    = 0;

            agentInfo.AgentID       = Convert.ToInt32(hfAgentID.Value);
            agentInfo.AgentCode     = txtAgentCode.Text;
            agentInfo.RouteID       = Convert.ToInt32(dpRoute.SelectedItem.Value);
            agentInfo.AgentName     = txtAgentName.Text;
            agentInfo.DateofJoining = txtDateOfJoing.Text;
            agentInfo.AppriveBy     = txtApprovedBy.Text;
            if (dpStatus.SelectedItem.Value == "1")
            {
                agentInfo.Status = true;
            }
            if (dpStatus.SelectedItem.Value == "2")
            {
                agentInfo.Status = false;
            }
            //agentInfo.EmployeeID = 1;// Convert.ToInt32(dpEmployeeID.SelectedItem.Value);
            agentInfo.Agensytype    = dpAgencyType.SelectedItem.Text;
            agentInfo.Address1      = txtAddress1.Text;
            agentInfo.Address2      = txtAddress2.Text;
            agentInfo.Address3      = txtAddress3.Text;
            agentInfo.Email         = txtEmail.Text;;
            agentInfo.TelephoneNo   = txtTelephone.Text;;
            agentInfo.MobileNo      = txtMobile.Text;
            agentInfo.Districk      = dpDistric.SelectedItem.Text;
            agentInfo.City          = dpCity.SelectedItem.Text;
            agentInfo.State         = dpState.SelectedItem.Text;
            agentInfo.Country       = dpCountry.SelectedItem.Text;
            agentInfo.BillingMethod = dpbillingtype.SelectedItem.Text;
            agentInfo.PaymentType   = dppaymenttype.SelectedItem.Text;;
            agentInfo.DepositAmount = string.IsNullOrEmpty(txtDepositeAmount.Text) ? 0 : Convert.ToDouble(txtDepositeAmount.Text);
            agentInfo.BankName      = dpBankName.SelectedItem.Text;
            agentInfo.AccounNo      = txtAccountNo.Text;
            agentInfo.AccountType   = dpAccountType.SelectedItem.Text;
            agentInfo.IFSCCode      = dpIfscCode.SelectedItem.Text;
            agentInfo.Volume        = txtValoume.Text;
            agentInfo.NoofTrays     = string.IsNullOrEmpty(txtNoOfTrays.Text) ? 0 : Convert.ToInt32(txtNoOfTrays.Text);
            if (dpDoorToDoor.SelectedItem.Value == "1")
            {
                agentInfo.DoortoDoor = true;
            }
            if (dpDoorToDoor.SelectedItem.Value == "1")
            {
                agentInfo.DoortoDoor = false;
            }

            if (rbcFreezerYes.Checked == true)
            {
                agentInfo.FreezerAvailable = true;
            }
            if (rbcFreezerNo.Checked == true)
            {
                agentInfo.FreezerAvailable = false;
            }
            if (rbFreezerRestrunYes.Checked == true)
            {
                agentInfo.FreezerRestrun = true;
            }
            if (rbFreezerRestrunNo.Checked == true)
            {
                agentInfo.FreezerRestrun = false;
            }
            if (txtDeactivedate.Text == "")
            {
                agentInfo.Deactivedate = txtDeactivedate.Text;
            }
            else
            {
                agentInfo.Deactivedate = (Convert.ToDateTime(txtDeactivedate.Text)).ToString("dd-MM-yyyy");
            }
            agentInfo.DeactiveReason    = Convert.ToString(txtDeactiveRession.Text);
            agentInfo.AmountReturned    = string.IsNullOrEmpty(txtAmountRetrun.Text) ? 0 : Convert.ToDouble(txtAmountRetrun.Text);
            agentInfo.TraysReturned     = string.IsNullOrEmpty(txtTraysReturned.Text) ? 0 : Convert.ToInt32(txtTraysReturned.Text);
            agentInfo.SchemeAmount      = string.IsNullOrEmpty(txtSchemeAmount.Text) ? 0 : Convert.ToDouble(txtSchemeAmount.Text);
            agentInfo.SchemeTotalAmount = string.IsNullOrEmpty(txtSchemeTotalAmount.Text) ? 0 : Convert.ToDouble(txtSchemeTotalAmount.Text);
            agentInfo.IsArchive         = false;
            agentInfo.CreatedBy         = GlobalInfo.Userid;
            agentInfo.Createddate       = DateTime.Now.ToString("dd-MM-yyyy");
            agentInfo.ModifiedBy        = GlobalInfo.Userid;
            agentInfo.ModifiedDate      = DateTime.Now.ToString("dd-MM-yyyy");
            agentInfo.flag = "Update";
            Result         = agentData.InsertAgentInfo(agentInfo);
            if (Result > 0)
            {
                divDanger.Visible      = false;
                divwarning.Visible     = false;
                divSusccess.Visible    = true;
                lblSuccess.Text        = "Agent Updated  Successfully";
                btnAddagent.Visible    = true;
                btnupdateagent.Visible = false;
                Clear();
                BinDAgentInfo();
                upMain.Update();
                pnlError.Update();
                uprouteList.Update();
                //txtAgentCode.Enabled = false;
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblWarningHead.Text = "   Please Contact to Site Admin";
                lblwarning.Text     = Comman.Comman.msg.ToString();
                pnlError.Update();
            }
        }