示例#1
0
        protected void loadAddrAndCurrDetails()
        {
            AddressDetails addrObj = BackEndObjects.AddressDetails.
                                     getAddressforMainBusinessEntitybyIdDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

            Label_Addr1.Text = addrObj.getAddrLine1();
            loadLocalityDetails(addrObj.getLocalityId());

            Dictionary <String, Currency> currDict = BackEndObjects.Currency.getAllCurrencyDetailsDB();

            foreach (KeyValuePair <String, Currency> kvp in currDict)
            {
                ListItem lt = new ListItem();
                lt.Text  = ((Currency)kvp.Value).getCurrencyName();
                lt.Value = ((Currency)kvp.Value).getCurrencyId();

                DropDownList_Base_Curr.Items.Add(lt);

                if (addrObj.getBaseCurrencyId() != null && !addrObj.getBaseCurrencyId().Equals("") &&
                    addrObj.getBaseCurrencyId().Equals(((Currency)kvp.Value).getCurrencyId()))
                {
                    DropDownList_Base_Curr.SelectedValue = lt.Value;
                }
            }
        }
示例#2
0
        protected void fillGrid()
        {
            ArrayList mBEList = BackEndObjects.MainBusinessEntity.getMainBusinessEntityListbyNameWithAddrDetailsDB(TextBox_Search_Contact.Text,
                                                                                                                   Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

            if (mBEList == null || mBEList.Count == 0)
            {
                Label_Status_Search.Visible   = true;
                Label_Status_Search.ForeColor = System.Drawing.Color.Red;
                Label_Status_Search.Text      = "No company found for the given id";
                GridView1.Visible             = false;
            }

            else
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("Name");
                dt.Columns.Add("Country");
                dt.Columns.Add("State");
                dt.Columns.Add("City");
                dt.Columns.Add("Locality");
                dt.Columns.Add("Street Name");
                dt.Columns.Add("Mob");
                dt.Columns.Add("Email");
                dt.Columns.Add("Contact Exists?");
                dt.Columns.Add("localId");
                dt.Columns.Add("ContactEntId");

                for (int i = 0; i < mBEList.Count; i++)
                {
                    //MainBusinessEntity mBEObj = BackEndObjects.MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(TextBox_Search_Contact.Text);
                    MainBusinessEntity mBEObj  = (MainBusinessEntity)mBEList[i];
                    AddressDetails     mBEAddr = mBEObj.getAddressDetails();

                    Contacts contactObj = Contacts.
                                          getContactDetailsforContactEntityDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), mBEObj.getEntityId());

                    Label_Status_Search.Visible = false;

                    BackEndObjects.Localities localObj   = null;
                    BackEndObjects.City       cityObj    = null;
                    BackEndObjects.State      stateObj   = null;
                    BackEndObjects.Country    countryObj = null;

                    if (mBEAddr.getLocalityId() != null && !mBEAddr.getLocalityId().Equals(""))
                    {
                        localObj   = Localities.getLocalitybyIdDB(mBEAddr.getLocalityId());
                        cityObj    = BackEndObjects.Localities.getCityDetailsforLocalitywoOtherAsscLocalitiesDB(mBEAddr.getLocalityId());
                        stateObj   = BackEndObjects.City.getStateDetailsforCitywoOtherAsscCitiesDB(cityObj.getCityId());
                        countryObj = BackEndObjects.State.getCountryDetailsforStatewoOtherAsscStatesDB(stateObj.getStateId());
                        //Session[SessionFactory.CREATE_CONTACT_LOCALITY_ID] = localObj.getLocalityId();
                        //Session[SessionFactory.CREATE_CONTACT_ADDRESS_LINE1] = mBEAddr.getAddrLine1();
                    }


                    dt.Rows.Add();

                    dt.Rows[i]["Name"] = mBEObj.getEntityName();
                    if (mBEAddr.getLocalityId() != null && !mBEAddr.getLocalityId().Equals(""))
                    {
                        dt.Rows[i]["Country"]      = countryObj.getCountryName();
                        dt.Rows[i]["State"]        = stateObj.getStateName();
                        dt.Rows[i]["City"]         = cityObj.getCityName();
                        dt.Rows[i]["Locality"]     = localObj.getLocalityName();
                        dt.Rows[i]["Street Name"]  = mBEAddr.getAddrLine1();
                        dt.Rows[i]["localId"]      = mBEAddr.getLocalityId();
                        dt.Rows[i]["ContactEntId"] = mBEAddr.getMainBusinessId();
                    }
                    else
                    {
                        dt.Rows[i]["Country"]      = "N/A";
                        dt.Rows[i]["State"]        = "N/A";
                        dt.Rows[i]["City"]         = "N/A";
                        dt.Rows[i]["Locality"]     = "N/A";
                        dt.Rows[i]["Street Name"]  = "N/A";
                        dt.Rows[i]["localId"]      = "";
                        dt.Rows[i]["ContactEntId"] = mBEObj.getEntityId();
                    }
                    dt.Rows[i]["Mob"]             = mBEObj.getPhNo();
                    dt.Rows[i]["Email"]           = mBEObj.getEmailId();
                    dt.Rows[i]["Contact Exists?"] = ((contactObj.getContactEntityId() != null && !contactObj.getContactEntityId().Equals("")) ? "Y" : "N");
                }
                GridView1.DataSource = dt;
                GridView1.DataBind();
                GridView1.Visible             = true;
                GridView1.Columns[10].Visible = false;
                GridView1.Columns[11].Visible = false;


                Session[SessionFactory.CREATE_CONTACT_DATA_GRID] = dt;
            }
        }
        protected void Button_Refresh_Click(object sender, EventArgs e)
        {
            //fillContactGrid();

            String entId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString();

            foreach (GridViewRow gVR in GridView1.Rows)
            {
                if (((Label)gVR.Cells[0].FindControl("Label_From_Site")).Text.Equals("Y"))
                {
                    //Refresh the contacts which are taken from the site
                    String contactEntId = ((Label)gVR.Cells[0].FindControl("Label_Hidden")).Text;

                    Dictionary <String, String> whereCls = new Dictionary <string, string>();
                    whereCls.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_CONTACT_ENTITY_ID, contactEntId);
                    whereCls.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_ENTITY_ID, entId);

                    MainBusinessEntity mBEObj  = BackEndObjects.MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(contactEntId);
                    AddressDetails     addrObj = AddressDetails.getAddressforMainBusinessEntitybyIdDB(mBEObj.getEntityId());
                    Dictionary <String, ProductCategory> mainProdList = MainBusinessEntity.getProductDetailsforMainEntitybyIdDB(contactEntId);

                    String prodList = "";

                    foreach (KeyValuePair <String, ProductCategory> kvp in mainProdList)
                    {
                        prodList += kvp.Value.getCategoryId() + ",";
                    }

                    if (prodList.Length > 0)
                    {
                        prodList = prodList.TrimEnd(',');
                    }

                    Dictionary <String, String> targetVals = new Dictionary <string, string>();
                    targetVals.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_EMAIL_ID, mBEObj.getEmailId());
                    targetVals.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_MOB_NO, mBEObj.getPhNo());
                    targetVals.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_CONTACT_NAME, mBEObj.getEntityName());
                    targetVals.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_LOCALITY_ID, addrObj.getLocalityId());
                    targetVals.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_STREET_NAME, addrObj.getAddrLine1());
                    targetVals.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_PROD_LIST, prodList);

                    BackEndObjects.Contacts.updateContactDetailsDB(targetVals, whereCls, DBConn.Connections.OPERATION_UPDATE);
                }
                fillContactGrid();
            }
            Button_Audit_Contact.Enabled = false;
            Button_Notes_Contact.Enabled = false;

            GridView1.SelectedIndex = -1;
        }