コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)

        {
            try
            {
                Common.WriteLog("Save button Clicked");
                if (txtName.Text.Trim().Length == 0)
                {
                    Telerik.WinControls.RadMessageBox.Show("Opportunity Name Should not be blank", "Validation", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                    txtName.Focus();
                    return;
                }
                strExpression = ddlSource.SelectedValue.ToString();
                if (strExpression == "")
                {
                    Telerik.WinControls.RadMessageBox.Show("Please Add formula.", "Validation", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                    ddlSource.Focus();
                    return;
                }

                if (strCurrentSegmentColumn == "")
                {
                    Telerik.WinControls.RadMessageBox.Show("Please Select Segment ", "Validation", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                    return;
                }

                //string strEx = strExpression.Replace("FIELD!", "");
                //if (strEx.StartsWith("="))
                //    strEx = strEx.Substring(1);

                Common.strFormula       = strExpression;
                Common.sOpportunityName = Common.sOpportunityName = txtName.Text;

                int iIsActive = 0;
                if (chkIsActive.Checked)
                {
                    iIsActive = 1;
                }

                iOpportunityId = ClsObj.fnSaveOpportunity(iOpportunityId, txtName.Text.ToString(), txtDesc.Text.ToString(), strExpression, Common.strPtnlFilter, Common.iUserID, Common.iProjectID, Common.strTableName, Common.strKeyName, Common.timePeriods.strtp1, Common.timePeriods.strtp2, iIsActive, ((Enums.OpportunityType)ddlOpportunityType.SelectedIndex).ToString());
                Common.WriteLog("New Opportunity is added to the OPPORTUNITY table");

                fnSaveThresholdAndPotential(iOpportunityId);
                Common.strPtnlFilter = "";
                frmOriginal frmorgin = (frmOriginal)Common.TopMostParent(this);
                frmorgin.fnOffersOpprortunityCount();
                bIsOnMain = false;

                Common.WriteLog("Threshold and Potential are added to Status Breakdown");
            }
            catch (Exception ex)
            {
                Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
            }
            Common.WriteLog("Save Complete");
        }
コード例 #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt    = ((DataTable)grdOppList.DataSource);
                DataRow[] drRow = dt.Select("Select=1");
                if (drRow.Length == 0)
                {
                    Telerik.WinControls.RadMessageBox.Show(this, "Select at least one Opportunity.", "Information", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                    return;
                }
                else
                {
                    DialogResult ds = Telerik.WinControls.RadMessageBox.Show(this, "Do you wish to delete selected Opportunity(s)?, you will lost all the info of the Opportunity(s)", "Confirmation", MessageBoxButtons.YesNo, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                    if (ds != DialogResult.Yes)
                    {
                        return;
                    }
                    ArrayList recForDelete = new ArrayList();
                    string    strId        = "";
                    for (int i = 0; i < drRow.Length; i++)
                    {
                        strId = drRow[i]["OPPORTUNITY_ID"].ToString();


                        if (ClsObj.fnCheckOPPHasInRanking("'" + drRow[i]["OPP_NAME"].ToString() + "'", Common.iProjectID))
                        {
                            Telerik.WinControls.RadMessageBox.Show(this, "This opportunity is selected in Ranking, you can not delete this Opportunity", "Confirmation", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                            break;
                        }

                        recForDelete.Add(strId + ";" + drRow[i]["OPP_NAME"].ToString());

                        //recForDelete.Add(new ValueItemPair(strId, drRow[i]["OPP_NAME"].ToString()));
                    }

                    if (recForDelete.Count > 0)
                    {
                        if (!ClsObj.fnDeleteOpportunity(recForDelete))
                        {
                            return;
                        }
                    }
                    fnLoadOpportunity();
                }
            }
            catch (Exception ex)
            {
                Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
コード例 #3
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult ds = RadMessageBox.Show(this, "This will apply the rules on the entire dataset, are you sure you want to continue", "Confirmation", MessageBoxButtons.YesNo, RadMessageIcon.Info);
                if (ds.ToString() == "Yes")
                {
                    if (objRanking.fnRankingcriteria(Common.iProjectID).Rows.Count > 0)
                    {
                        alert = new AlertForm();
                        alert.SetMessage("Loading data. Please wait..."); // "Loading data. Please wait..."
                        alert.TopMost       = true;
                        alert.StartPosition = FormStartPosition.CenterScreen;
                        alert.Show();
                        alert.Refresh();
                        fnCreateView();
                        string strT1String = clstreDetails.fnBuildTimePeriod(Common.timePeriods.strtp1);
                        string strT2String = clstreDetails.fnBuildTimePeriod(Common.timePeriods.strtp2);
                        // clstreDetails.fnDeleteTreOppfrmExport();
                        //if (ClsObj.fnRunOPoortunities(Common.iProjectID, Common.strTableName, strT1String, strT2String, strMainFilter))
                        //{
                        //    objRanking.fnMainRankingfrmExport(Common.iProjectID);
                        //    fnShowOpportunitiesDetails();

                        //    clstreDetails.fnDropTableTab(Common.strTableName);
                        //}

                        if (ClsObj.fnRunOPoortunitiesfrmProcedure(Common.iProjectID, Common.strTableName, strT1String, strT2String))
                        {
                            objRanking.fnMainRankingfrmExport(Common.iProjectID);
                            fnShowOpportunitiesDetails();
                            //clstreDetails.fnDropTableTab(Common.strTableName);
                        }

                        alert.Close();
                    }
                    else
                    {
                        Telerik.WinControls.RadMessageBox.Show(this, "Select the  Ranking Criteria ,Inorder to run Opportunities ", "Information", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                alert.Close();
                MessageBox.Show(ex.Message);
            }
        }
コード例 #4
0
        private void btnRnkngSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (objRanking.fnCheckOpportunityExists(Common.iProjectID))
                {
                    if (ddRankingCriteria.SelectedItem.ToString() == RecoEngine_BI.Enums.Rank_Criteria.Custom.ToString())
                    {
                        if ((ddlOppRank1.SelectedIndex == -1) && (ddlOppRank2.SelectedIndex == -1) && (ddlOppRank3.SelectedIndex == -1) && (ddlOppRank4.SelectedIndex == -1))
                        {
                            Telerik.WinControls.RadMessageBox.Show(this, "Please select the opportunity.", "Opportunity Ranking", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                            ddlOppRank1.Focus();
                            return;
                        }
                        else
                        {
                            string strRank2 = "";
                            string strRank3 = "";
                            string strRank4 = "";
                            if (ddlOppRank1.SelectedValue == null)
                            {
                                Telerik.WinControls.RadMessageBox.Show(this, "Please select opportunity 1.", "Opportunity Ranking", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                                ddlOppRank1.Focus();
                                return;
                            }


                            if (ddlOppRank2.SelectedIndex != -1)
                            {
                                strRank2 = ddlOppRank2.SelectedItem.ToString();
                                if (strRank2 == ddlOppRank1.SelectedValue.ToString())
                                {
                                    Telerik.WinControls.RadMessageBox.Show(this, "An Opportunity is Selected for More then One Rank.", "Opportunity Ranking", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                                    ddlOppRank2.Focus();
                                    return;
                                }
                            }
                            else if (ddlOppRank2.SelectedIndex == -1 && ddlOppRank2.Enabled == true)
                            {
                                Telerik.WinControls.RadMessageBox.Show(this, "Please Select the Opportunity for Rank 2.", "Opportunity Ranking", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                                ddlOppRank4.Focus();
                                return;
                            }

                            if (ddlOppRank3.SelectedIndex != -1)
                            {
                                strRank3 = ddlOppRank3.SelectedItem.ToString();
                                if (strRank3 == strRank2 || strRank3 == ddlOppRank1.SelectedValue.ToString())
                                {
                                    Telerik.WinControls.RadMessageBox.Show(this, "An Opportunity is Selected for More then One Rank.", "Opportunity Ranking", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                                    ddlOppRank3.Focus();
                                    return;
                                }
                            }
                            else if (ddlOppRank3.SelectedIndex == -1 && ddlOppRank3.Enabled == true)
                            {
                                Telerik.WinControls.RadMessageBox.Show(this, "Please Select the Opportunity for Rank 3.", "Opportunity Ranking", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                                ddlOppRank4.Focus();
                                return;
                            }


                            if (ddlOppRank4.SelectedIndex != -1)
                            {
                                strRank4 = ddlOppRank4.SelectedItem.ToString();
                                if (strRank4 == strRank3 || strRank4 == strRank2 || strRank4 == ddlOppRank1.SelectedValue.ToString())
                                {
                                    Telerik.WinControls.RadMessageBox.Show(this, "An Opportunity is Selected for More then One Rank.", "Opportunity Ranking", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                                    ddlOppRank4.Focus();
                                    return;
                                }
                            }

                            else if (ddlOppRank4.SelectedIndex == -1 && ddlOppRank4.Enabled == true)
                            {
                                Telerik.WinControls.RadMessageBox.Show(this, "Please Select the Opportunity for Rank 4.", "Opportunity Ranking", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                                ddlOppRank4.Focus();
                                return;
                            }


                            ClsObj.fnSaveOPPRanking("Custom", Common.iProjectID, ddlOppRank1.SelectedItem.ToString(), strRank2, strRank3, strRank4);
                            objRanking.fnCustomRanking(Common.iProjectID, ddlOppRank1.SelectedItem.ToString(), strRank2, strRank3, strRank4);
                            fnBindRanking();
                        }
                    }
                    else
                    {
                        string strRank1 = "NULL";
                        string strRank2 = "NULL";
                        string strRank3 = "NULL";
                        string strRank4 = "NULL";

                        ClsObj.fnSaveOPPRanking("Potential", Common.iProjectID, strRank1, strRank2, strRank3, strRank4);
                        objRanking.fnPotentialRanking(Common.iProjectID);
                        fnBindRanking();
                    }
                }
                else
                {
                    Telerik.WinControls.RadMessageBox.Show(this, "There are no Opportunities to do ranking ", "Opportunity Ranking", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                }
            }
            catch (Exception ex)
            {
                Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
コード例 #5
0
        private void btnOppInactive_Click(object sender, EventArgs e)
        {
            try
            {
                clsOpportunities clsObj = new clsOpportunities();
                DataTable        dt     = ((DataTable)grdOppList.DataSource);
                DataRow[]        drRow  = dt.Select("Flag='Y'");
                if (drRow.Length == 0)
                {
                    Telerik.WinControls.RadMessageBox.Show(this, "Active/Inactive at least one Opportunity.", "Information", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                    return;
                }
                else
                {
                    DialogResult ds = Telerik.WinControls.RadMessageBox.Show(this, "Do you wish to Active/Inactive selected Campaign(s)?", "Confirmation", MessageBoxButtons.YesNo, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                    if (ds != DialogResult.Yes)
                    {
                        return;
                    }
                    ArrayList recForInactive = new ArrayList();
                    string    strId          = "";
                    for (int i = 0; i < drRow.Length; i++)
                    {
                        strId = drRow[i]["OPP_NAME"].ToString();

                        if (ClsObj.fnCheckOPPHasInRanking(strId, Common.iProjectID))
                        {
                            Telerik.WinControls.RadMessageBox.Show(this, "This opportunity is selected in Ranking, you can not Inactive this Opportunity", "Confirmation", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                            break;
                        }
                        if ((bool)drRow[i]["Active"])
                        {
                            strId += ";1";
                        }
                        else
                        {
                            strId += ";0";
                        }
                        recForInactive.Add(strId);
                    }

                    if (recForInactive.Count > 0)
                    {
                        for (int i = 0; i < recForInactive.Count; i++)
                        {
                            if (!clsObj.fnActiveOpportunities(recForInactive[i].ToString()))
                            {
                                return;
                            }
                        }
                    }


                    fnLoadOpportunity();
                }
            }
            catch (Exception ex)
            {
                Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }