Exemplo n.º 1
0
        private void SeachAutoParticipantData()
        {
            AutoParticipantSession();
            autoParticipantSearchBL = new AutoParticipantSearchBL();
            //JIRA-1048 --Changes to handle single quote -- Start
            DataSet autoPartData = autoParticipantSearchBL.SearchAutoParticipantData(txtMarketingOwner.Text.Replace("'", "").Trim(), txtWEASalesLabel.Text.Replace("'", "").Trim(), txtArtist.Text.Replace("'", "").Trim(), txtProject.Text.Replace("'", "").Trim(), out errorId);

            //JIRA-1048 --Changes to handle single quote -- End
            autoParticipantSearchBL = null;
            if (autoPartData.Tables.Count != 0 && errorId != 2)
            {
                if (autoPartData.Tables[0].Rows.Count == 0 && errorId != 2)
                {
                    dtEmpty = new DataTable();
                    gvAutoParticipantDtls.EmptyDataText = "No data found for the selected filter criteria";
                    BindGrid(autoPartData.Tables[0]);
                    Session["AutoParticipantData"] = null;
                }
                else
                {
                    Session["AutoParticipantData"] = autoPartData.Tables[0];
                    BindGrid(autoPartData.Tables[0]);
                    if (autoPartData.Tables[0].Rows.Count == 1 && hdnIsNewRequest.Value == "Y")
                    {
                        Response.Redirect("../Participants/AutoParticipantMaintenance.aspx?autoPartId=" + autoPartData.Tables[0].Rows[0]["auto_participant_id"].ToString() + "", false);
                    }
                }
            }
            else
            {
                ExceptionHandler("Error in fetching data", string.Empty);
            }
        }
Exemplo n.º 2
0
        private void SaveAutoParticipant(int autoPartId, string marketingOwner, string weaSalesLabel, string artist, string projectTitle)
        {
            string userCode = Convert.ToString(Session["UserCode"]);

            marketingOwner = marketingOwner == "" ? "-" : marketingOwner.Trim().ToUpper();
            weaSalesLabel  = weaSalesLabel == "" ? "-" : weaSalesLabel.Trim().ToUpper();
            int artistId  = artist == "" ? -1 : Convert.ToInt32(artist.Split('-')[0].Trim());
            int projectId = projectTitle == "" ? -1 : Convert.ToInt32(projectTitle.Split('-')[0].Trim());

            //projectTitle = projectTitle == "" ? "-" : projectTitle.Split('-')[1].Trim();
            projectTitle = projectTitle == "" ? "-" : projectTitle.Substring((projectTitle.IndexOf('-') + 2), (projectTitle.Length - projectTitle.IndexOf('-') - 2));

            //JIRA-1048 --Changes to handle single quote -- Start
            string marketingOnwerSearch = txtMarketingOwner.Text.Replace("'", "").Trim();
            string weaSalesLabelSearch  = txtWEASalesLabel.Text.Replace("'", "").Trim();
            string artistSearch         = txtArtist.Text.Replace("'", "").Trim();
            string projectSearch        = txtProject.Text.Replace("'", "").Trim();

            //JIRA-1048 --Changes to handle single quote -- End

            autoParticipantSearchBL = new AutoParticipantSearchBL();
            DataSet autoParticipantData = autoParticipantSearchBL.AddUpdateAutoParticipant(autoPartId, marketingOwner, weaSalesLabel,
                                                                                           artistId, projectId, projectTitle, marketingOnwerSearch, weaSalesLabelSearch, artistSearch, projectSearch, userCode, out newAutoPartId, out errorId);

            autoParticipantSearchBL = null;
            if (errorId == 0)
            {
                if (autoPartId == 0 && newAutoPartId != 0)
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "NewAutoParticipSave", "RedirectToAutoParticipMaint(" + newAutoPartId + ");", true);
                }
                else
                {
                    if (autoParticipantData.Tables[0].Rows.Count == 0 && errorId != 2)
                    {
                        dtEmpty = new DataTable();
                        gvAutoParticipantDtls.EmptyDataText = "No data found for the selected filter criteria";
                        BindGrid(autoParticipantData.Tables[0]);
                        Session["AutoParticipantData"] = null;
                    }
                    else
                    {
                        Session["AutoParticipantData"] = autoParticipantData.Tables[0];
                        BindGrid(autoParticipantData.Tables[0]);
                    }

                    msgView.SetMessage("Participation Group updated successfully.", MessageType.Success, PositionType.Auto);
                }
            }
            else if (errorId == 1)
            {
                msgView.SetMessage("This Participant Group already exists.", MessageType.Warning, PositionType.Auto);
                return;
            }
            else
            {
                msgView.SetMessage("Failed to save Participation Group.", MessageType.Warning, PositionType.Auto);
                return;
            }
        }