Пример #1
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();
            }
        }
Пример #2
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();
            }
        }