Esempio n. 1
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();
                }
            }
        }
Esempio n. 2
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();
            }
        }