Ejemplo n.º 1
0
        private int SaveDoorknocksHead()
        {
            objSQLDB      = new SQLDB();
            objDnkDetails = new DnkDetailsDB();
            string sqlText     = "";
            string sqlTextCust = "";
            int    intRec      = 0;

            try
            {
                DataSet dsCnt = objDnkDetails.DNKSearch_Get(txtCustomerName.Text, txtVillage.Text, txtMandal.Text, txtState.Text);
                if (dsCnt.Tables[0].Rows.Count == 0)
                {
                    sqlText = "INSERT INTO SALES_DNK_HEAD(SDH_COMPANY_CODE,SDH_STATE_CODE,SDH_BRANCH_CODE,SDH_FIN_YEAR,SDH_DOCUMENT_MONTH,SDH_EORA_CODE,SDH_TRN_DATE,SDH_TRN_NUMBER,	SDH_FARMER_ID,SDH_LEAD_TYPE,SDH_DEMO_DETL,SDH_DNH_REMARKS,SDH_CREATED_BY,SDH_AUTHORIZED_BY,SDH_CREATED_DATE)"+
                              " VALUES ('" + CommonData.CompanyCode + "', '" + CommonData.StateCode + "', '" + CommonData.BranchCode + "' , '" + CommonData.FinancialYear + "','" + CommonData.DocMonth + "'," + strECode + ", '" + Convert.ToDateTime(meTNRDate.Value).ToString("dd/MMM/yyyy") + "'" +
                              ",'" + txtTNRNo.Text + "',99999, '" + cmleadType.Text + "', '" + cmbDemoDtls.Text +
                              "','" + txtRemarks.Text + "','" + CommonData.LogUserId + "', '" + CommonData.LogUserId + "', '" + Convert.ToDateTime(CommonData.CurrentDate).ToString("dd/MMM/yyyy") + "')";

                    sqlTextCust = "INSERT INTO SALES_DNK_CUST_DETL (SDC_COMPANY_CODE,SDC_STATE_CODE,SDC_BRANCH_CODE,SDC_FIN_YEAR,SDC_DOCUMENT_MONTH,SDC_EORA_CODE,SDC_TRN_DATE,SDC_TRN_NUMBER,SDC_SL_NO,SDC_VILLAGE,SDC_FARMER_NAME,SDC_SO_FO,SDC_FORG_NAME,SDC_MOBILE_NUMBER,SDC_MANDAL,SDC_DISTRICT,SDC_STATE,SDC_PIN)" +
                                  " VALUES ('" + CommonData.CompanyCode + "', '" + CommonData.StateCode + "', '" + CommonData.BranchCode + "' , '" + CommonData.FinancialYear + "','" + CommonData.DocMonth + "'," + strECode + ", '" + Convert.ToDateTime(meTNRDate.Value).ToString("dd/MMM/yyyy") +
                                  "','" + txtTNRNo.Text + "',1,'" + txtVillage.Text + "','" + txtCustomerName.Text + "','" + cbRelation.Text + "','" + txtRelationName.Text + "','" + txtMobileNo.Text + "','" + txtMandal.Text + "','" + txtDistrict.Text + "','" + txtState.Text + "','" + txtPin.Text + "')";
                }
                else
                {
                    string sqlDelete = "DELETE from SALES_DNK_DETL" +
                                       " WHERE SDD_COMPANY_CODE='" + CommonData.CompanyCode +
                                       "' AND SDD_BRANCH_CODE='" + CommonData.BranchCode +
                                       "' AND SDD_TRN_NUMBER=" + txtTNRNo.Text +
                                       "  AND SDD_FIN_YEAR='" + CommonData.FinancialYear + "' AND SDD_DOCUMENT_MONTH='" + CommonData.DocMonth + "'";
                    intRec = objSQLDB.ExecuteSaveData(sqlDelete);

                    sqlText = "UPDATE SALES_DNK_HEAD SET SDH_COMPANY_CODE='" + CommonData.CompanyCode +
                              "',SDH_STATE_CODE='" + CommonData.StateCode + "',SDH_BRANCH_CODE='" + CommonData.BranchCode +
                              "',SDH_DOCUMENT_MONTH='" + CommonData.DocMonth + "',SDH_FIN_YEAR='" + CommonData.FinancialYear + "',SDH_TRN_DATE='" + Convert.ToDateTime(meTNRDate.Value).ToString("dd/MMM/yyyy") +
                              "',SDH_LEAD_TYPE='" + cmleadType.Text + "',SDH_DEMO_DETL='" + cmbDemoDtls.Text + "',SDH_DNH_REMARKS='" + txtRemarks.Text +
                              "',SDH_EORA_CODE='" + strECode + "',SDH_LAST_MODIFIED_BY='" + CommonData.LogUserId + "',SDH_LAST_MODIFIED_DATE='" + CommonData.CurrentDate +
                              "' WHERE ltrim(rtrim(SDH_TRN_NUMBER))='" + txtTNRNo.Text.Trim() + "'";

                    sqlTextCust = "UPDATE SALES_DNK_CUST_DETL SET SDC_COMPANY_CODE='" + CommonData.CompanyCode + "',SDC_STATE_CODE='" + CommonData.StateCode + "',SDC_BRANCH_CODE='" + CommonData.BranchCode + "',SDC_FIN_YEAR='" + CommonData.FinancialYear +
                                  "',SDC_DOCUMENT_MONTH='" + CommonData.DocMonth + "',SDC_EORA_CODE='" + strECode + "',SDC_TRN_DATE='" + Convert.ToDateTime(meTNRDate.Value).ToString("dd/MMM/yyyy") + "',SDC_VILLAGE='" + txtVillage.Text + "',SDC_FARMER_NAME='" + txtCustomerName.Text + "',SDC_SO_FO='" + cbRelation.Text +
                                  "',SDC_FORG_NAME='" + txtRelationName.Text + "',SDC_MOBILE_NUMBER='" + txtMobileNo.Text + "',SDC_MANDAL='" + txtMandal.Text + "',SDC_DISTRICT='" + txtDistrict.Text + "',SDC_STATE='" + txtState.Text + "',SDC_PIN='" + txtPin.Text +
                                  "' WHERE ltrim(rtrim(SDC_TRN_NUMBER))=" + txtTNRNo.Text.Trim();
                }
                intRec = 0;
                intRec = objSQLDB.ExecuteSaveData(sqlText);
                intRec = objSQLDB.ExecuteSaveData(sqlTextCust);
            }
            catch (Exception ex)
            {
                intRec = 0;
                MessageBox.Show(ex.Message);
            }
            finally
            {
                objSQLDB = null;
            }
            return(intRec);
        }
Ejemplo n.º 2
0
        private bool FindInputCustomerSearch()
        {
            bool blFind = false;

            objDnkDetails = new DnkDetailsDB();
            try
            {
                for (int i = 0; i < this.cbCustomer.Items.Count; i++)
                {
                    string strItem = ((System.Data.DataRowView)(this.cbCustomer.Items[i])).Row.ItemArray[1] + "".ToString().Trim();
                    if (strItem.IndexOf(txtCustomerSearch.Text) > -1)
                    {
                        DataSet ds = new DataSet();
                        blFind = true;
                        cbCustomer.SelectedIndex = i;
                        ds = objDnkDetails.DNKSearch_Get(strItem, txtVillage.Text, txtMandal.Text, txtState.Text);
                        DataTable dt = ds.Tables[0];

                        if (dt.Rows.Count == 1)
                        {
                            strFormerid           = Convert.ToString(dt.Rows[0]["SDH_FARMER_ID"] + "");
                            strECode              = dt.Rows[0]["SDH_EORA_CODE"] + "";
                            cbEcode.SelectedValue = strECode;
                            meTNRDate.Value       = Convert.ToDateTime(dt.Rows[0]["SDH_TRN_DATE"]);
                            txtVillage.Text       = dt.Rows[0]["SDC_VILLAGE"] + "";
                            txtMandal.Text        = dt.Rows[0]["SDC_MANDAL"] + "";
                            txtDistrict.Text      = dt.Rows[0]["SDC_DISTRICT"] + "";
                            txtState.Text         = dt.Rows[0]["SDC_STATE"] + "";
                            txtPin.Text           = dt.Rows[0]["SDC_PIN"] + "";
                            txtCustomerName.Text  = dt.Rows[0]["SDC_FARMER_NAME"] + "";
                            cbRelation.Text       = dt.Rows[0]["SDC_SO_FO"] + "";
                            txtRelationName.Text  = dt.Rows[0]["SDC_FORG_NAME"] + "";
                            txtMobileNo.Text      = dt.Rows[0]["SDC_MOBILE_NUMBER"].ToString();
                            txtTNRNo.Text         = dt.Rows[0]["SDH_TRN_NUMBER"].ToString();
                            cmleadType.Text       = dt.Rows[0]["SDH_LEAD_TYPE"].ToString();
                            cmbDemoDtls.Text      = dt.Rows[0]["SDH_DEMO_DETL"].ToString();
                            txtRemarks.Text       = dt.Rows[0]["SDH_DNH_REMARKS"].ToString();
                            lblCustomerId.Text    = strFormerid;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            finally
            {
                objData = null;
            }
            return(blFind);
        }
Ejemplo n.º 3
0
        private void cbCustomer_SelectedIndexChanged(object sender, EventArgs e)
        {
            objDnkDetails = new DnkDetailsDB();
            try
            {
                if (cbCustomer.SelectedIndex > -1)
                {
                    if (this.cbCustomer.Items[cbCustomer.SelectedIndex].ToString() != "")
                    {
                        DataSet ds = new DataSet();
                        ds = objDnkDetails.DNKSearch_Get(((System.Data.DataRowView)(cbCustomer.Items[cbCustomer.SelectedIndex])).Row.ItemArray[1].ToString(), txtVillage.Text.ToString(), txtMandal.Text.ToString(), txtState.Text.ToString());
                        DataTable dt = ds.Tables[0];

                        if (dt.Rows.Count == 1)
                        {
                            strFormerid           = Convert.ToString(dt.Rows[0]["SDH_FARMER_ID"] + "");
                            strECode              = dt.Rows[0]["SDH_EORA_CODE"] + "";
                            cbEcode.SelectedValue = strECode;
                            meTNRDate.Value       = Convert.ToDateTime(dt.Rows[0]["SDH_TRN_DATE"]);
                            txtVillage.Text       = dt.Rows[0]["SDC_VILLAGE"] + "";
                            txtMandal.Text        = dt.Rows[0]["SDC_MANDAL"] + "";
                            txtDistrict.Text      = dt.Rows[0]["SDC_DISTRICT"] + "";
                            txtState.Text         = dt.Rows[0]["SDC_STATE"] + "";
                            txtPin.Text           = dt.Rows[0]["SDC_PIN"] + "";
                            txtCustomerName.Text  = dt.Rows[0]["SDC_FARMER_NAME"] + "";
                            cbRelation.Text       = dt.Rows[0]["SDC_SO_FO"] + "";
                            txtRelationName.Text  = dt.Rows[0]["SDC_FORG_NAME"] + "";
                            txtMobileNo.Text      = dt.Rows[0]["SDC_MOBILE_NUMBER"] + "";
                            txtTNRNo.Text         = dt.Rows[0]["SDH_TRN_NUMBER"] + "";
                            cmleadType.Text       = dt.Rows[0]["SDH_LEAD_TYPE"].ToString() + "";
                            cmbDemoDtls.Text      = dt.Rows[0]["SDH_DEMO_DETL"].ToString() + "";
                            txtRemarks.Text       = dt.Rows[0]["SDH_DNH_REMARKS"].ToString() + "";
                            lblCustomerId.Text    = strFormerid;
                        }
                        ds = null;
                        dt = null;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            finally
            {
                objDnkDetails = null;
            }
        }
Ejemplo n.º 4
0
        private void FillCustomerFarmerData(string sSearch, string sCustId)
        {
            DataSet ds = null;

            objDnkDetails = new DnkDetailsDB();
            try
            {
                if (sSearch.Trim() != "" || sCustId.Length > 0)
                {
                    Cursor.Current = Cursors.WaitCursor;

                    ds = new DataSet();
                    ds = objDnkDetails.DNKSearch_Get(sSearch, txtVillage.Text, txtMandal.Text, txtState.Text);
                    DataTable dt = ds.Tables[0];

                    if (dt.Rows.Count == 1)
                    {
                        strFormerid           = Convert.ToString(dt.Rows[0]["SDH_FARMER_ID"] + "");
                        strECode              = dt.Rows[0]["SDH_EORA_CODE"] + "";
                        cbEcode.SelectedValue = strECode;
                        meTNRDate.Value       = Convert.ToDateTime(dt.Rows[0]["SDH_TRN_DATE"]);
                        txtVillage.Text       = dt.Rows[0]["SDC_VILLAGE"] + "";
                        txtMandal.Text        = dt.Rows[0]["SDC_MANDAL"] + "";
                        txtDistrict.Text      = dt.Rows[0]["SDC_DISTRICT"] + "";
                        txtState.Text         = dt.Rows[0]["SDC_STATE"] + "";
                        txtPin.Text           = dt.Rows[0]["SDC_PIN"] + "";
                        txtCustomerName.Text  = dt.Rows[0]["SDC_FARMER_NAME"] + "";
                        cbRelation.Text       = dt.Rows[0]["SDC_SO_FO"] + "";
                        txtRelationName.Text  = dt.Rows[0]["SDC_FORG_NAME"] + "";
                        txtMobileNo.Text      = dt.Rows[0]["SDC_MOBILE_NUMBER"] + "";
                        txtTNRNo.Text         = dt.Rows[0]["SDH_TRN_NUMBER"] + "";
                        cmleadType.Text       = dt.Rows[0]["SDH_LEAD_TYPE"].ToString();
                        cmbDemoDtls.Text      = dt.Rows[0]["SDH_DEMO_DETL"].ToString();
                        txtRemarks.Text       = dt.Rows[0]["SDH_DNH_REMARKS"].ToString();
                        lblCustomerId.Text    = strFormerid;
                    }
                    else if (dt.Rows.Count > 1)
                    {
                        FillCustomerComboBox(dt);
                    }
                    else
                    {
                        cbCustomer.DataSource = null;
                        cbCustomer.DataBindings.Clear();
                        cbCustomer.Items.Clear();
                        txtCustomerName.Text = "";
                        txtRelationName.Text = "";
                        txtMobileNo.Text     = "";
                        strFormerid          = "";
                        //txtTNRNo.Text = "";
                        //meTNRDate.Text = "";
                        lblCustomerId.Text = "";
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                objDnkDetails = null;
                ds.Dispose();
                Cursor.Current = Cursors.Default;
            }
        }