Esempio n. 1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string        strResult         = string.Empty;
            string        strVal            = "";
            List <string> lstQuery          = new List <string>();
            string        strEventID        = "";
            string        strClassID        = "";
            string        strSectionID      = "";
            string        strDate           = txtDate.Text.Trim();
            string[]      strClassSectionID = txtClassSection.Text.Trim().ToString().Split('~');
            strEventID = objCCWeb.ReturnSingleValue("SELECT EventID From EventMaster Where EventDate='" + objCCWeb.ChangeYYYYMMDD(strDate) + "'");

            if (strEventID == "")
            {
                strEventID = objCCWeb.ReturnSingleValue("SELECT ISNULL(Max(EventID),0)+1 From EventMaster");
            }
            lstQuery.Add("Delete from EventMaster where EventID=" + strEventID + "");
            //lstQuery.Add("Delete from eventclassDetail where EventID=" + strEventID + "");
            //lstQuery.Add("Delete from EventDetail where EventID=" + strEventID + "");

            lstQuery.Add("INSERT INTO EventMaster (EventID,EventDate,EntryUID,EntryDate) Values(" + strEventID + ",'" + objCCWeb.ChangeYYYYMMDD(strDate) + "'," + Session["UID"] + ",getdate())");

            for (int intLoop = 0; intLoop < strClassSectionID.Length - 1; intLoop++)
            {
                strClassID   = strClassSectionID[intLoop].Split('^')[0];
                strSectionID = strClassSectionID[intLoop].Split('^')[1];
                lstQuery.Add("INSERT INTO eventclassDetail (EventID,ClassID,SectionID) Values(" + strEventID + ",'" + strClassID + "','" + strSectionID + "')");
            }
            for (int intRow = 0; intRow < gvEventDetails.Rows.Count; intRow++)
            {
                string strTime         = Request.Form[gvEventDetails.Rows[intRow].UniqueID + "$txtTime"].Trim().Replace("'", "''");
                string strEventSubject = Request.Form[gvEventDetails.Rows[intRow].UniqueID + "$txtEventSubject"].Trim().Replace("'", "''");
                string strVenue        = Request.Form[gvEventDetails.Rows[intRow].UniqueID + "$txtVenue"].Trim().Replace("'", "''");
                string strDescription  = Request.Form[gvEventDetails.Rows[intRow].UniqueID + "$txtDiscription"].Trim().Replace("'", "''");
                lstQuery.Add("INSERT INTO EventDetail (EventID,EventTime,EventSubject,Venue,Discription) " +
                             " Values(" + strEventID + ",'" + strTime + "','" + strEventSubject + "','" + strVenue + "','" + strDescription + "')");
            }
            strResult = objCCWeb.ExecuteQueryList(lstQuery);

            if (strResult == "")
            {
                btnDoubleClick_Click(sender, e);
                ClientScript.RegisterStartupScript(this.GetType(), "displaySave", "<script language=javascript> alert('Saved Successfully');</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "disError", "<script language=javascript>alert('" + strResult + "')</script>");
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>alert('" + ex.Message + "')</script>");
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strResult   = "";
        int    intSchoolID = 0;

        string[] strArray = this.hidFlag.Value.Split('^');
        try
        {
            List <string> lstArray  = new List <string>();
            byte[]        fileData  = null;
            byte[]        imageData = null;

            long lnLength = 0;

            fUploadEmblem.Attributes["filename"] = hdnSImagePath.Value;
            if (fUploadEmblem.PostedFile.FileName != "")
            {
                if (fUploadEmblem.HasFile)
                {
                    try
                    {
                        Stream myStream = fUploadEmblem.PostedFile.InputStream;
                        lnLength = myStream.Length;
                        fileData = new byte[(int)myStream.Length];
                        myStream.Read(fileData, 0, (int)lnLength);
                        myStream.Close();
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            string strEmblemStatus;
            if (rbtnYes.Checked == true)
            {
                strEmblemStatus = "Y";
            }
            else
            {
                strEmblemStatus = "N";
            }
            //if (strArray[0] == "N" || strArray[0]=="E" && strArray[3].Trim().ToUpper() != txtAddress.Text.Trim().ToUpper())
            //{
            //    if (objCCWeb.ReturnNumericValue("SELECT COUNT(SchoolID) FROM MTClientCompany WHERE Address='" + txtAddress.Text.Trim().Replace("'", "''") + "'") > 0)
            //    {
            //        strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "5", lblAddress.Text);
            //        ClientScript.RegisterStartupScript(this.GetType(), "", "<script>" + strHideID + "alert('" + strResult + "')</script>");
            //        //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>" + strHideID + "alert('Address Already Exist')</script>");
            //        hidFlag.Value = "S";
            //        return;
            //    }
            //}
            if (strArray[0] == "E")
            {
                lstArray.Add("UPDATE MTClientCompany SET SchoolName1=" + objCCWeb.fReplaceChar(txtInstitution1) + ",SchoolName2='" + txtInstitution2.Text.Trim().Replace("'", "''") + "',Address=" + objCCWeb.fReplaceChar(txtAddress) + ",ReportHeader=" + objCCWeb.fReplaceChar(txtReportHeader) +
                             ",City=" + objCCWeb.fReplaceChar(txtCity) + ",State=" + objCCWeb.fReplaceChar(txtState) + ",Pincode=" + objCCWeb.fReplaceChar(txtPincode) + ",Telephone=" + objCCWeb.fReplaceChar(txtTelephone) + "," +
                             "Fax=" + objCCWeb.fReplaceChar(txtFax) + ",Email=" + objCCWeb.fReplaceChar(txtEmail) + ",DirectorName=" + objCCWeb.fReplaceChar(txtDirector) + ",DirectorTelephone=" + objCCWeb.fReplaceChar(txtDirPhone) +
                             ",PrincipalName=" + objCCWeb.fReplaceChar(txtPrincipal) + ",PrincipalPhone=" + objCCWeb.fReplaceChar(txtPriPhone) + ",VicePrincipalName=" + objCCWeb.fReplaceChar(txtVicePrincipal) + "," +
                             "VicePrincipalPhone=" + objCCWeb.fReplaceChar(txtVicePriPhone) + ",AdministratorName=" + objCCWeb.fReplaceChar(txtAdministrator) + ",AdministratorPhone=" + objCCWeb.fReplaceChar(txtAdmPhone) + ",Affiliation=" + objCCWeb.fReplaceChar(txtAffiliation) +
                             ",Medium=" + objCCWeb.fReplaceChar(txtMedium) + ",Motto=" + objCCWeb.fReplaceChar(txtMotto) + ",EstablishedOn=" + objCCWeb.fReplaceChar(txtEstablishedOn) + ",EstablishmentCode=" + objCCWeb.fReplaceChar(txtEstablishmentCode) + "," +
                             "BankAccountNo=" + objCCWeb.fReplaceChar(txtBankACNo) + ",EmblemStatus='" + strEmblemStatus + "',UpdateUserID=" + Session["UID"].ToString() + ",UpdateDate=GETDATE(),PLPackDate=" + objCCWeb.ReturnDateorNull(txtPLPackDate.Text.Trim()) + ",PLPackdateStaff=" + objCCWeb.ReturnDateorNull(txtPLPackDateStaff.Text.Trim()) + " WHERE SchoolID=" + strArray[1] + "");

                lstArray.Add("INSERT INTO UserUpdateDetails(UID,SessionID,UpdateDate,FormName,Details) VALUES(" + Session["UID"] + ",'" + Session.SessionID + "',GETDATE(),'mnuInstitutionMaster','School " + (txtInstitution1.Text.Trim().Replace("'", "''") != "" ? txtInstitution1.Text.Trim().Replace("'", "''") : txtInstitution2.Text.Trim().Replace("'", "''")) + " Information ,Is Modified')");
            }
            else
            {
                intSchoolID = objCCWeb.ReturnNumericValue("SELECT ISNULL(MAX(SchoolID),0)+1 FROM MTClientCompany");

                lstArray.Add("INSERT INTO MTClientCompany(SchoolID,SchoolName1,SchoolName2,Address,ReportHeader,City,State,Pincode,Telephone,Fax,Email,DirectorName,DirectorTelephone,PrincipalName,PrincipalPhone,VicePrincipalName,VicePrincipalPhone,AdministratorName,AdministratorPhone," +
                             "Affiliation,Medium,Motto,EstablishedOn,EstablishmentCode,BankAccountNo,EmblemStatus,EntryUserID,EntryDate) SELECT ISNULL(MAX(SchoolID),0)+1, '" + txtInstitution1.Text.Trim().Replace("'", "''") + "','" + txtInstitution2.Text.Trim().Replace("'", "''") + "','" + txtAddress.Text.Trim().Replace("'", "''") + "','" + txtReportHeader.Text.Trim().Replace("'", "''") +
                             "','" + txtCity.Text.Trim().Replace("'", "''") + "','" + txtState.Text.Trim().Replace("'", "''") + "','" + txtPincode.Text.Trim().Replace("'", "''") + "','" + txtTelephone.Text.Trim().Replace("'", "''") + "'," +
                             "'" + txtFax.Text.Trim().Replace("'", "''") + "','" + txtEmail.Text.Trim().Replace("'", "''") + "','" + txtDirector.Text.Trim().Replace("'", "''") + "','" + txtDirPhone.Text.Trim().Replace("'", "''") +
                             "','" + txtPrincipal.Text.Trim().Replace("'", "''") + "','" + txtPriPhone.Text.Trim().Replace("'", "''") + "','" + txtVicePrincipal.Text.Trim().Replace("'", "''") + "'," +
                             "'" + txtVicePriPhone.Text.Trim().Replace("'", "''") + "','" + txtAdministrator.Text.Trim().Replace("'", "''") + "','" + txtAdmPhone.Text.Trim().Replace("'", "''") + "','" + txtAffiliation.Text.Trim().Replace("'", "''") +
                             "','" + txtMedium.Text.Trim().Replace("'", "''") + "','" + txtMotto.Text.Trim().Replace("'", "''") + "','" + txtEstablishedOn.Text.Trim().Replace("'", "''") + "','" + txtEstablishmentCode.Text.Trim().Replace("'", "''") + "'," +
                             "'" + txtBankACNo.Text.Trim().Replace("'", "''") + "','" + strEmblemStatus + "'," + Session["UID"].ToString() + ",GETDATE() FROM MTClientCompany");
            }
            strResult = objCCWeb.ExecuteQueryList(lstArray);
            if (strArray[0] == "E")
            {
                intSchoolID = Convert.ToInt32(strArray[1]);
            }

            if (hidFlag.Value == "N^")
            {
                hidFlag.Value = "N^";
            }
            else
            {
                hidFlag.Value = "E^";
            }
            if (strResult == "")
            {
                if (lnLength > 0)
                {
                    //SqlConnection conSImage = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings.Get("ConnectionString"));
                    SqlConnection conSImage = new SqlConnection(objCCWeb.ReturnConnectionString());
                    conSImage.Open();
                    SqlCommand cmdSImage = new SqlCommand("UPDATE MTClientCompany SET Emblem=@img,EmblemLength=" + lnLength.ToString() + " where SchoolID=" + intSchoolID + "", conSImage);
                    cmdSImage.CommandType = CommandType.Text;
                    cmdSImage.Parameters.Add(new SqlParameter("@img", SqlDbType.Image));
                    cmdSImage.Parameters["@img"].Value = fileData;
                    cmdSImage.ExecuteNonQuery();
                    conSImage.Close();
                    conSImage.Dispose();
                }
                if (lnLength == 0)
                {
                    if (strArray[0] == "E")
                    {
                        SqlDataReader rdrImage = objCCWeb.BindReader("SELECT ISNULL(Emblem,'') AS Emblem,CAST(ISNULL(EmblemLength,0) AS INT) AS EmblemLength FROM MTClientCompany WHERE SchoolID=" + intSchoolID + "");
                        if (rdrImage.Read())
                        {
                            int intLength = (int)rdrImage["EmblemLength"];
                            imageData = new byte[intLength];
                            imageData = (byte[])rdrImage["Emblem"];
                            if (intLength != 0)
                            {
                                lnLength = intLength;
                            }
                        }
                        rdrImage.Close();
                        rdrImage.Dispose();
                    }
                }
                if (strArray[0] == "N")
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "1", "");
                }
                else
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "2", "");
                }
                ClientScript.RegisterStartupScript(this.GetType(), "displayScriptMsg", "<script>" + strHideID + "alert('" + strResult + "')</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "displayE", "<script language=javascript>" + strHideID + "alert('" + strResult + "')</script>");
            }
            if (fUploadEmblem.PostedFile.FileName == "")
            {
                fileData = imageData;
            }
            btnCancel_Click(sender, e);
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>" + strHideID + "alert('" + ex.Message + "')</script>");
        }
        BindDDL();
        btnCancel_Click(sender, e);
    }
Esempio n. 3
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        try
        {
            string        strResult;
            List <string> strQuery    = new List <string>();
            string        UpdatedFile = "";
            txtMessage.Text = ObjccWeb.fReplaceChars(txtMessage.Text);
            string File        = FileUpload1.FileName.ToString();
            string strAttachID = ObjccWeb.ReturnSingleValue("Select Isnull(Max(AttachmentID)+1,0) From MessageFileUpload");
            /*-----Added By Manju on 19-07-2012--------*/
            string strUserName = "";
            /*-----End of Added By Manju on 19-07-2012--------*/
            if (strAttachID == "0")
            {
                strAttachID = "1";
            }

            HidAttach.Value = strAttachID;


            if (txtMailTo.Text != "" && txtMailFrom.Text != "")
            {
                string file = FileUpload1.FileName.ToString();
                if (file != "")
                {
                    UpdatedFile = "";
                    UpdatedFile = file;
                    SaveFile(FileUpload1);
                    strQuery.Add("Insert into MessageFileUpload values (" + strAttachID + ",'" + HidFilename.Value + "'," + Session["UID"] + ",getdate())");
                    SqlDataReader rdr1 = ObjccWeb.BindReader("Select UID From MTUSerMaster Where UserID in ('" + txtMailTo.Text.Trim().Replace(",", "','") + "')");
                    while (rdr1.Read())
                    {
                        //  strQuery.Add("Insert Into MessageSendDetails select ISNULL(Max(MessageID),0)+1," + Session["UID"] + "," + rdr1.GetValue(0).ToString() + ",'" + txtMailSubject.Text.Trim() + "','" + txtMessage.Text.Trim().Replace("'", "''") + "',getdate(),'UR'," + Session["AcaStart"] + "," + Session["StudentID"] + ",''," + strAttachID + " from MessageSendDetails");
                    }
                    rdr1.Close();
                    rdr1.Dispose();
                }
                else
                {
                    SqlDataReader rdr1 = ObjccWeb.BindReader("Select UID From MTUSerMaster Where UserID in ('" + txtMailTo.Text.Trim().Replace(",", "','") + "')");
                    while (rdr1.Read())
                    {
                        // strQuery.Add("Insert Into MessageSendDetails select ISNULL(Max(MessageID),0)+1," + Session["UID"] + "," + rdr1.GetValue(0).ToString() + ",'" + txtMailSubject.Text.Trim() + "','" + txtMessage.Text.Trim().Replace("'", "''") + "',getdate(),'UR'," + Session["AcaStart"] + "," + Session["StudentID"] + ",'',0 from MessageSendDetails");
                    }
                    rdr1.Close();
                    rdr1.Dispose();
                }


                //string file = FileUpload1.FileName.ToString();
                //if (file != "")
                //{
                //    UpdatedFile = "";
                //    UpdatedFile = file;
                //    SaveFile(FileUpload1);
                //    SqlDataReader rdr1 = ObjccWeb.BindReader("Select UID,UserTypeID,UserName,UserID From MTUSerMaster Where UserID in ('" + txtMailTo.Text.Trim().Replace(",", "','") + "')");
                //    SqlDataReader rdr3 = ObjccWeb.BindReader("Select UID,UserTypeID,UserName,UserID From MTUSerMaster Where UserID in ('" + txtMailTo.Text.Trim().Replace(",", "','") + "') AND UserTypeID=3");
                //    while (rdr3.Read())
                //    {
                //        strUserName += rdr3.GetValue(2).ToString() + "(" + rdr3.GetValue(3).ToString() + "),";

                //    }
                //    rdr3.Close();
                //    rdr3.Dispose();
                //    while (rdr1.Read())
                //    {
                //        if (rdr1.GetValue(1).ToString() == "3")
                //        {
                //            ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script>HideComposeBox();alert('This Message Cannot Be Send To User " + strUserName + "');</script>");
                //            //return;
                //        }
                //        else
                //        {
                //            if (ObjccWeb.ReturnNumericValue("SELECT COUNT(*) FROM MessageSendDetails") == 0)
                //            {
                //                strResult = ObjccWeb.ExecuteQuery("Insert Into MessageSendDetails(MessageID,FromUID,ToUID,Subject,Contents,Date,ReadUnread,AcaStart,StudentID,Status,AttachmentID) VALUES (0,0,0,'','',NULL,'',0,0,'',0)");
                //            }
                //            strQuery.Add("Insert Into MessageSendDetails select Isnull(Max(MessageID)+1,1)," + Session["UID"] + "," + rdr1.GetValue(0).ToString() + ",'" + txtMailSubject.Text.Trim() + "','" + txtMessage.Text.Trim().Replace("'", "''") + "',getdate(),'UR'," + Session["AcaStart"] + "," + Session["StudentID"] + ",''," + strAttachID + " from MessageSendDetails");
                //            strQuery.Add("Insert into MessageFileUpload values (" + strAttachID + ",'" + HidFilename.Value + "'," + Session["UID"] + ",getdate())");
                //        }
                //     }
                //    rdr1.Close();
                //    rdr1.Dispose();
                //}
                //else
                //{
                //    SqlDataReader rdr1 = ObjccWeb.BindReader("Select UID,UserTypeID,UserName,UserID From MTUSerMaster Where UserID in ('" + txtMailTo.Text.Trim().Replace(",", "','") + "')");
                //    SqlDataReader rdr2 = ObjccWeb.BindReader("Select UID,UserTypeID,UserName,UserID From MTUSerMaster Where UserID in ('" + txtMailTo.Text.Trim().Replace(",", "','") + "') AND UserTypeID=3");
                //    while (rdr2.Read())
                //    {
                //        strUserName += rdr2.GetValue(2).ToString() + "(" + rdr2.GetValue(3).ToString() + "),";

                //    }
                //    rdr2.Close();
                //    rdr2.Dispose();
                //    while (rdr1.Read())
                //    {
                //        if (rdr1.GetValue(1).ToString() == "3")
                //        {

                //            ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script>HideComposeBox();alert('This Message Cannot Be Send To User " + strUserName + "');</script>");

                //            //return;
                //        }
                //        else
                //        {
                //            if (ObjccWeb.ReturnNumericValue("SELECT COUNT(*) FROM MessageSendDetails") == 0)
                //            {
                //                strResult = ObjccWeb.ExecuteQuery("Insert Into MessageSendDetails(MessageID,FromUID,ToUID,Subject,Contents,Date,ReadUnread,AcaStart,StudentID,Status,AttachmentID) VALUES (0,0,0,'','',NULL,'',0,0,'',0)");
                //            }
                //            strQuery.Add("Insert Into MessageSendDetails select Isnull(Max(MessageID)+1,1)," + Session["UID"] + "," + rdr1.GetValue(0).ToString() + ",'" + txtMailSubject.Text.Trim() + "','" + txtMessage.Text.Trim().Replace("'", "''") + "',getdate(),'UR'," + Session["AcaStart"] + "," + Session["StudentID"] + ",'',0 from MessageSendDetails");
                //        }

                //    }
                //    rdr1.Close();
                //    rdr1.Dispose();

                //}
            }
            //if (File != "")
            //{
            //    SaveFile(FileUpload1);
            //    strQuery.Add("Insert Into MessageFileUpload ");

            //}

            strResult = ObjccWeb.ExecuteQueryList(strQuery);
            if (strResult == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script>document.getElementById('divCompose').style.display='none';document.getElementById('divInbox').style.display='';document.getElementById('divSendTo').style.display='none';document.getElementById('divdet').style.display='none';alert('Send SucessFully');</script>");
                hidEnabl.Value = "";
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script>alert('" + ex.Message.ToString().Replace("'", "") + "');</script>");
        }
    }
Esempio n. 4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string   strResult;
            string   strResult1;
            string[] astrFlag = hidFlag.Value.Split('^');
            if (astrFlag[0] == "N")
            {
                astrFlag[1] = "0";
            }
            List <string> lstArray = new List <string>();

            if (astrFlag[0] == "N")
            {
                //  objCCWeb.FillCheckedBoxList(chkReportName, "SELECT 0 AS ReportID,'' AS ReportName" + Session["Type"] + " UNION SELECT ReportID,ReportName" + Session["Type"] + " FROM MTReportMaster WHERE ReportID>0 AND ModuleID="+Convert.ToInt32(ddlModuleID.SelectedValue)+"ORDER BY ReportID, ReportName" + Session["Type"] + "", "ReportID", "ReportName" + Session["Type"] + "", " ");

                if (objCCWeb.ReturnNumericValue("SELECT Count(*) FROM MTReportGroupMaster WHERE ModuleID=" + ddlModuleID.SelectedValue + "") == 5)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language='javascript'>" + strHideID + "alert('Only Five Group Per Module Is Allowed To Create')</script>");
                    return;
                }
                if (objCCWeb.ReturnNumericValue("SELECT COUNT(GroupId) FROM MTReportGroupMaster WHERE UPPER(PriorityNo)='" + txtpriority.Text.Trim() + "' AND GroupId<>" + astrFlag[1] + " AND ModuleID=" + ddlModuleID.SelectedValue) > 0)
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "5", lblpriority.Text);
                    ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language='javascript'>" + strHideID + "alert('" + strResult + "')</script>");
                    txtpriority.Focus();
                    return;
                }


                if (objCCWeb.ReturnNumericValue("SELECT COUNT(GroupId) FROM MTReportGroupMaster WHERE UPPER(GroupName)='" + txtReportGroupName1.Text.Trim().Replace("'", "''").ToUpper() + "' AND GroupId<>" + astrFlag[1]) > 0)
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "5", lblpriority.Text);
                    ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language='javascript'>" + strHideID + "alert('" + strResult + "');</script>");
                    txtReportGroupName1.Focus();
                    return;
                }


                if (objCCWeb.ReturnNumericValue("SELECT COUNT(*) FROM MTReportGroupMaster") == 0)
                {
                    strResult = objCCWeb.ExecuteQuery("INSERT INTO MTReportGroupMaster(GroupID,GroupName,ModuleID,PriorityNo) values(0,'',0,0)");
                }
                strResult = objCCWeb.ExecuteQuery("INSERT INTO MTReportGroupMaster(GroupID,GroupName,ModuleID,PriorityNo) SELECT ISNULL(MAX(GroupID),0)+1,'" + txtReportGroupName1.Text.Trim().Replace("'", "''") + "'," + ddlModuleID.SelectedValue + "," + txtpriority.Text.Trim() + " FROM MTReportGroupMaster ");
                int GroupID = objCCWeb.ReturnNumericValue("SELECT ISNULL(MAX(GroupID),0) FROM MTReportGroupMaster");
                for (int intForLoop = 0; intForLoop < chkReportName.Items.Count; intForLoop++)
                {
                    if (chkReportName.Items[intForLoop].Selected == true)
                    {
                        string[] ReportName  = chkReportName.Items[intForLoop].Text.Split('#');
                        int      INTModuleID = objCCWeb.ReturnNumericValue("SELECT ModuleID FROM MTReportMaster where ReportName" + Session["Type"] + "='" + ReportName[0].Trim() + "'");
                        int      INTReportID = objCCWeb.ReturnNumericValue("SELECT ReportID FROM MTReportMaster where ReportName" + Session["Type"] + "='" + ReportName[0].Trim() + "'");
                        //lstArray.Add("INSERT INTO MTReportGroupMaster(ModuleID) VALUES("+  INTModuleID + ")");
                        lstArray.Add("INSERT INTO MTReportGroupDetails(GroupID,ReportID) Values(" + GroupID + "," + INTReportID + ")");
                    }
                }
                strResult1 = objCCWeb.ExecuteQueryList(lstArray);
            }
            else
            {
                if (astrFlag[0] == "E" && astrFlag[6].Trim() != txtpriority.Text.Trim())
                {
                    //int moduleid = int.Parse(ddlModuleID.SelectedValue);
                    // int i = objCCWeb.ReturnNumericValue("SELECT COUNT(GroupId) FROM MTReportGroupMaster WHERE UPPER(PriorityNo)='" + txtpriority.Text.Trim() + "' AND GroupId<>" + astrFlag[1] + " AND ModuleID=" + ddlModuleID.SelectedValue);
                    if (objCCWeb.ReturnNumericValue("SELECT COUNT(GroupId) FROM MTReportGroupMaster WHERE UPPER(PriorityNo)='" + txtpriority.Text.Trim() + "' AND GroupId<>" + astrFlag[1] + " AND ModuleID=" + astrFlag[5]) > 0)
                    {
                        strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "5", lblpriority.Text);
                        ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language='javascript'>" + strHideID + "alert('" + strResult + "')</script>");
                        hidFlag.Value = "E'" + "^" + "^" + "^" + "^" + "^" + "^";
                        //string str = hidFlag.Value.Split('^');
                        //  str.Replace('E','U');
                        //  hidFlag.Value = str;
                        //string temp="U";
                        //for (int i = 0; i < str.Length; i++)
                        //{
                        //    if (str[i] == 'E')
                        //    {
                        //        temp = temp + str[i];
                        //    }
                        //}

                        //  astrFlag[0].Replace('E','U');
                        //hidFlag.Value = "";
                        txtpriority.Focus();
                        return;
                    }
                }

                if (astrFlag[0] == "E" && astrFlag[2].Trim().ToUpper() != txtReportGroupName1.Text.Trim().ToUpper())
                {
                    if (objCCWeb.ReturnNumericValue("SELECT COUNT(GroupID) FROM MTReportGroupMaster WHERE UPPER(GroupName)='" + txtReportGroupName1.Text.Trim().Replace("'", "''").ToUpper() + "' AND GroupId<>" + astrFlag[1]) > 0)
                    {
                        strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "5", lblReportGroupName1.Text);
                        ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language='javascript'>" + strHideID + "alert('" + strResult + "')</script>");
                        hidFlag.Value = "E'" + "^" + "^" + "^" + "^" + "^" + "^";
                        //hidFlag.Value = "";
                        txtReportGroupName1.Focus();
                        return;
                    }
                }


                //lstArray.Add("DELETE FROM MTReportGroupMaster WHERE GroupID =" + Convert.ToInt32(astrFlag[1]) + "");
                lstArray.Add("DELETE FROM MTReportGroupDetails Where GroupID=" + Convert.ToInt32(astrFlag[1]) + "");
                strResult = objCCWeb.ExecuteQuery("UPDATE MTReportGroupMaster SET GroupName='" + txtReportGroupName1.Text.Trim().Replace("'", "''") + "',ModuleID=" + astrFlag[5] + ",PriorityNo=" + txtpriority.Text.Trim() + "WHERE GroupId=" + Convert.ToInt32(astrFlag[1]) + "");
                int GroupID = objCCWeb.ReturnNumericValue("SELECT ISNULL(MAX(GroupID),0)  FROM MTReportGroupMaster");
                for (int intForLoop = 0; intForLoop < chkReportName.Items.Count; intForLoop++)
                {
                    if (chkReportName.Items[intForLoop].Selected == true)
                    {
                        string[] ReportName = chkReportName.Items[intForLoop].Text.Split('#');

                        int INTModuleID = Convert.ToInt32(ddlModuleID.SelectedValue); //objCCWeb.ReturnNumericValue("SELECT Moduleid FROM MTUserGroupMaster where ModuleName" + Session["Type"] + "='" + ModuleID[0].Trim() + "'");
                        //int INTReportID = objCCWeb.ReturnNumericValue("SELECT ReportID FROM MTReportMaster where ReportName" + Session["Type"] + "='" + ReportName[intForLoop].Trim() + "'");
                        int INTReportID = Convert.ToInt32(chkReportName.Items[intForLoop].Value);
                        //lstArray.Add("INSERT INTO MTReportGroupMaster(GroupID,ModuleID) VALUES(" + Convert.ToInt32(astrFlag[1]) + "," + INTModuleID + ")");
                        lstArray.Add("Insert INTO MTReportGroupDetails(GroupID,ReportID) VALUES(" + Convert.ToInt32(astrFlag[1]) + "," + INTReportID + ")");
                    }
                }
                strResult1 = objCCWeb.ExecuteQueryList(lstArray);
            }
            btnCancel_Click(sender, e);
            //strResult1 = objCCWeb.ExecuteQueryList(lstArray);
            if (strResult == "")
            {
                if (astrFlag[0] == "N")
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "1", "");
                }
                else
                {
                    strResult = objCCWeb.pDisplayMessage("" + Session["Type"].ToString() + "", "2", "");
                }
                ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>" + strHideID + "alert('" + strResult + "');</script>");
                objCCWeb.FillCheckedBoxList(chkReportName, "SELECT ReportID,ReportName" + Session["Type"] + " FROM MTReportMaster WHERE ReportID>0 ORDER BY ReportID, ReportName" + Session["Type"] + "", "ReportID", "ReportName" + Session["Type"] + "", "");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "displayScript", "<script language=javascript>" + strHideID + "alert('" + strResult + "')</script>");
            }
            hidFlag.Value = "";
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "disError", "<script language='javascript'>" + strHideID + "alert('" + ex.Message.ToString().Replace("'", "") + "');</script>");
        }
    }