コード例 #1
0
        private void BindGrid()
        {
            objCompetitorAgentMasterDal = new CompetitorAgentMasterDal();
            DataSet dsAgent = objCompetitorAgentMasterDal.GetCompetitor("");
            radgrdAgent.DataSource = dsAgent;
            radgrdAgent.DataBind();
            ViewState[vsAgent] = dsAgent;

        }
コード例 #2
0
        protected void radgrdAgent_OnItemCommand(object sender, GridCommandEventArgs e)
        {

            if (e.Item != null)
            {

                if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
                {
                    GridDataItem item = radgrdAgent.Items[e.Item.ItemIndex];
                    Label lblAgentId = (Label)item.FindControl("lblgrdAgentIdItem");

                    DataSet dsCustomer = new DataSet();
                    CompetitorAgentMasterDal objCompetitorAgentMasterDal = new CompetitorAgentMasterDal();
                    dsCustomer = objCompetitorAgentMasterDal.GetCompetitorCustomer(Convert.ToInt32(lblAgentId.Text));

                    if (dsCustomer.Tables[0].Rows.Count == 0)
                    {

                        lblTitleAlert.Text = "No Data Found";
                    }
                    else
                    {
                        lblTitleAlert.Text = "Customer Details";

                    }

                    radGrdCustomer.DataSource = dsCustomer.Tables[0];
                    radGrdCustomer.DataBind();
                    PopEx_lnkBtnChangePreference.Show();


                }
            }
        }
コード例 #3
0
        protected void acbAgent_SearchClick(object sender, EventArgs e)
        {

            try
            {




                objCompetitorAgentMasterDal = new CompetitorAgentMasterDal();
                DataSet dsAgent = objCompetitorAgentMasterDal.GetCompetitor(acbAgent.SearchTextBox.Text);
                radgrdAgent.DataSource = dsAgent;
                radgrdAgent.DataBind();
                ViewState[vsAgent] = dsAgent;



            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
コード例 #4
0
        protected void acbAgent_DeleteClick(object sender, EventArgs e)
        {
            try
            {
                StringBuilder AgentId = new StringBuilder();
                int result = 0;
                if (ViewState[PageConstants.vsItemIndexes] != null)
                    htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes];

                if (htItemIndex != null)
                {
                    foreach (int i in htItemIndex.Values)
                    {

                        Label lblAgentId = (Label)radgrdAgent.Items[i].FindControl("lblgrdAgentIdItem");
                        if (lblAgentId != null)
                        {
                            AgentId.Append(lblAgentId.Text + ",");
                        }
                    }
                }

                objCompetitorAgentMasterDal = new CompetitorAgentMasterDal();
                String AddId = AgentId.ToString().TrimEnd(',');
                result = objCompetitorAgentMasterDal.DeleteAgent(AddId);


                if (result == 1)
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Delete].ToString());
                    Master.MessageCssClass = "successMessage";
                    ViewState[PageConstants.vsItemIndexes] = null;
                    BindGrid();
                }
                else if (result == 547)
                {
                    Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Delete].ToString());
                    Master.MessageCssClass = "errorMessage";
                }
            }

            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
コード例 #5
0
        protected void acbAgent_SaveClick(object sender, EventArgs e)
        {
            objCompetitorAgentMasterBDto = new CompetitorAgentMasterBDto();


            try
            {
                int result = 0;
                objCompetitorAgentMasterDal = new CompetitorAgentMasterDal();
                switch (acbAgent.SaveButton.CommandName)
                {
                    case "Save":
                      
                        SaveCompetitor();
                        pnlAddNewMode.Visible = false;
                        acbAgent.EditableMode = false;
                        BindGrid();
                        break;

                    case "Update":
                        Update();
                        break;
                }
            }


            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
コード例 #6
0
        private void Update()
        {
            try
            {
                int result = 0;
                objCompetitorAgentMasterDal = new CompetitorAgentMasterDal();
                objCompetitorAgentMasterBDto = new CompetitorAgentMasterBDto();
                objCompetitorAgentMasterBDto.AgentName = txtAgentName.Text.Trim();
                objCompetitorAgentMasterBDto.AgentAddress = txtAddress.Text.Trim();
                objCompetitorAgentMasterBDto.CityId = Convert.ToInt32(radCmbCity.SelectedValue);
                objCompetitorAgentMasterBDto.StateId = Convert.ToInt32(radCmbState.SelectedValue);
                objCompetitorAgentMasterBDto.CountryId = Convert.ToInt32(radCmbCountry.SelectedValue);
                objCompetitorAgentMasterBDto.Phone = txtphone.Text.Trim();
                objCompetitorAgentMasterBDto.OwnerCompanyId = objAuthorizationBDto.UserSelectedCompanyId;
                objCompetitorAgentMasterBDto.UserId = objAuthorizationBDto.UserProfile.UserId;
                objCompetitorAgentMasterBDto.AgentId = Convert.ToInt32(ViewState["AgentId"]);

                result = objCompetitorAgentMasterDal.UpdateAgent(objCompetitorAgentMasterBDto);
                if (result >= 1)
                {
                    pnlAddNewMode.Visible = false;
                    acbAgent.EditableMode = false;
                    BindGrid();
                    Reset();

                    Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
                    Master.MessageCssClass = "successMessage";
                }
                else
                {
                    Master.DisplayMessage("Agent Name Already Exist");
                    //Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString());
                    Master.MessageCssClass = "errorMessage";
                }

            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }