private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtName.Text.Trim().Length == 0)
                {
                    Telerik.WinControls.RadMessageBox.Show("Offer Name Should not be blank", "Validation", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                    txtName.Focus();
                    return;
                }


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

                iOfferID = clsObj.fnSaveOffers(iOfferID, txtName.Text.ToString(), txtCode.Text, txtDesc.Text.ToString(), ddlLevel2.SelectedValue.ToString(), ddlLevel3.SelectedValue.ToString(), ddlLevel4.SelectedValue.ToString(), ddlLevel5.SelectedValue.ToString(), Common.iUserID, Common.iProjectID, iIsActive);

                Telerik.WinControls.RadMessageBox.Show("Successfully saved.", "Validation", MessageBoxButtons.OK, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                radNew_Click(null, null);
                frmOriginal frmorgin = (frmOriginal)Common.TopMostParent(this);
                frmorgin.fnOffersOpprortunityCount();
                //frmorgin.fnShowOffers(1);
            }
            catch (Exception ex)
            {
                Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
Esempio n. 2
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");
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt    = ((DataTable)grdOffers.DataSource);
                DataRow[] drRow = dt.Select("Select=1");
                if (drRow.Length == 0)
                {
                    Telerik.WinControls.RadMessageBox.Show(this, "Select at least one Offer.", "Information", MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
                    return;
                }
                else
                {
                    DialogResult ds = Telerik.WinControls.RadMessageBox.Show(this, "Do you wish to delete selected Offer(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]["OFFER_ID"].ToString();

                        if (clsObj.fnCheckOffersDependencies(strId))
                        {
                            ds = Telerik.WinControls.RadMessageBox.Show(this, "This offer has Campaigns?,do you want to delete the campaign details also r\n to delete please click yes else click no", "Confirmation", MessageBoxButtons.YesNo, RadMessageIcon.Info, MessageBoxDefaultButton.Button1);
                            if (ds != DialogResult.Yes)
                            {
                                break;
                            }
                            else
                            {
                                recForDelete.Add(strId);
                            }
                        }
                        else
                        {
                            recForDelete.Add(strId);
                        }


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

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

                    fnLoadOffers();
                    frmOriginal frmorgin = (frmOriginal)Common.TopMostParent(this);
                    frmorgin.fnOffersOpprortunityCount();
                }
            }
            catch (Exception ex)
            {
                Telerik.WinControls.RadMessageBox.Show(this, ex.Message, ex.TargetSite.Name.ToString(), MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }