Ejemplo n.º 1
0
 //private void BindDBID()
 //{
 //    objNotes = new NotesClass();
 //    DataTable dt = objNotes.GetALLDBID();
 //    ddlDBID.DataSource = dt;
 //    ddlDBID.DataTextField = "DBID";
 //    ddlDBID.DataValueField = "DBID";
 //    ddlDBID.DataBind();
 //}
 private void GetHandle()
 {
     try
     {
         objNotes             = new NotesClass();
         objNotes.NotesHandle = Request.QueryString["handle"];
         DataTable dt = objNotes.GetALLHandleByID();
         if (dt.Rows.Count > 0)
         {
             txtNotesHandle.Text    = dt.Rows[0]["NotesHandle"].ToString();
             txtAcessIndex.Text     = dt.Rows[0]["AccessIndex"].ToString();
             txtTableName.Text      = dt.Rows[0]["TableName"].ToString();
             txtTableDesc.Text      = dt.Rows[0]["TableDescription"].ToString();
             txtRemarks.Text        = dt.Rows[0]["Remarks"].ToString();
             txtDBID.Text           = dt.Rows[0]["DBID"].ToString();
             btnSaveHandle.Text     = "Update";
             txtNotesHandle.Enabled = false;
             divHeader.InnerText    = "Update Notes Handle";
         }
         else
         {
             btnSaveHandle.Text = "Save";
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not found');", true);
     }
 }
Ejemplo n.º 2
0
 protected void lnkDelete_Click(object sender, EventArgs e)
 {
     try
     {
         objNotes             = new NotesClass();
         objNotes.NotesHandle = Request.QueryString["handle"];
         DataTable dtHandle = objNotes.GetUsedHandle();
         if (dtHandle.Rows.Count == 0)
         {
             int res = objNotes.DeleteNotesHandle();
             if (res > 0)
             {
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Deleted Successfully');", true);
                 Response.Redirect("View_NotesHandle.aspx");
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Not Deleted');", true);
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Notes Handle used somewhere');", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not found');", true);
     }
 }
Ejemplo n.º 3
0
 protected void btnSaveColor_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtUser.Text != "" && hdfColor.Value != "")
         {
             string[]   user          = txtUser.Text.Split('-');
             NotesClass objNotesClass = new NotesClass();
             objNotesClass.User  = user[1].Trim();
             objNotesClass.Color = hdfColor.Value;
             int res = objNotesClass.InsertColor();
             if (res > 0)
             {
                 GEtUserColor();
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Successfully Assigned');", true);
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Not Assigned');", true);
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Please Enter all fields');", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Some technical issue Not Assigned');", true);
     }
 }
Ejemplo n.º 4
0
        private void GetNotes()
        {
            try
            {
                objNotes             = new NotesClass();
                objNotes.NotesHandle = Request.QueryString["handle"];
                objNotes.IndexValue  = Request.QueryString["index"];
                DataTable dt = objNotes.GetNotesFromASPNETUSer();
                if (dt.Rows.Count > 0)
                {
                    if (Request.QueryString["Hd"] == null)
                    {
                        spIndex.InnerHtml = dt.Rows[0]["TableDescription"].ToString() + " , " + Request.QueryString["index"];
                    }
                    rptNotes.DataSource = dt;
                    rptNotes.DataBind();
                }
                else
                {
                    if (Request.QueryString["Hd"] == null)
                    {
                        objNotes             = new NotesClass();
                        objNotes.NotesHandle = Request.QueryString["handle"];
                        DataTable dtHandle = objNotes.GetALLHandleByID();
                        spIndex.InnerHtml = dtHandle.Rows[0]["TableDescription"].ToString() + " , " + Request.QueryString["Index"];
                    }

                    //ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('No record found');", true);
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 5
0
        private void BindNotesHandle()
        {
            NotesClass objNotes = new NotesClass();
            DataTable  dt       = objNotes.GetALLNotesHandle();

            gvData.DataSource = dt;
            gvData.DataBind();
        }
Ejemplo n.º 6
0
        private void GEtUserColor()
        {
            NotesClass objNotesClass = new NotesClass();
            DataTable  dt            = objNotesClass.GEtUSerColor();

            gvdata.DataSource = dt;
            gvdata.DataBind();
        }
Ejemplo n.º 7
0
 protected void btnSaveHandle_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtNotesHandle.Text != "" && txtAcessIndex.Text != "" && txtTableName.Text != "")
         {
             objNotes             = new NotesClass();
             objNotes.DBID        = txtDBID.Text.Trim();
             objNotes.NotesHandle = txtNotesHandle.Text.Trim();
             objNotes.IndexValue  = txtAcessIndex.Text.Trim();
             objNotes.TableName   = txtTableName.Text.Trim();
             objNotes.TableDesc   = txtTableDesc.Text.Trim();
             objNotes.Remarks     = txtRemarks.Text.Trim();
             if (btnSaveHandle.Text == "Save")
             {
                 int res = objNotes.InsertNotesHandle();
                 if (res > 0)
                 {
                     txtNotesHandle.Text = "";
                     txtAcessIndex.Text  = "";
                     txtTableName.Text   = "";
                     txtTableDesc.Text   = "";
                     txtDBID.Text        = "";
                     txtRemarks.Text     = "";
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Data Saved Successfully');", true);
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Data Not Saved');", true);
                 }
             }
             else
             {
                 int res = objNotes.UpdateNotesHandle();
                 if (res > 0)
                 {
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Data Updated Successfully');", true);
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Data Not Updated');", true);
                 }
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Please enter all data');", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not found');", true);
     }
 }
Ejemplo n.º 8
0
        public static string[] GetUSer(string prefixText, int count)
        {
            NotesClass    objNotes = new NotesClass();
            DataTable     dt       = objNotes.GetUser(prefixText);
            List <string> lst      = new List <string>();

            foreach (DataRow dr in dt.Rows)
            {
                string UserId = dr["EmployeeName"].ToString() + "-" + dr["CardNo"].ToString();
                //  string UserName = ;
                lst.Add(UserId);
                //    lst.Add(UserName);
            }
            return(lst.ToArray());
        }
Ejemplo n.º 9
0
        private void GetNotesReminder()
        {
            NotesClass objNotes = new NotesClass();
            DataTable  dt       = objNotes.GetNotesReminder();

            if (dt.Rows.Count > 0)
            {
                gvData.DataSource = dt;
                gvData.DataBind();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('No record found');", true);
            }
        }
Ejemplo n.º 10
0
 protected void lnkUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         LinkButton lnkBtn = (LinkButton)sender;
         string[]   Value  = lnkBtn.CommandArgument.Split('&');
         string     uId    = Value[0];
         hdfUser.Value   = uId;
         hdfNoteId.Value = Value[1];
         objNotes        = new NotesClass();
         objNotes.NoteID = Value[1];
         DataTable dt = objNotes.GetNotesByRunningId();
         txtMailTo.Text      = dt.Rows[0]["SendEmailTo"].ToString();
         txtTitle.Text       = dt.Rows[0]["Title"].ToString();
         txtDescription.Text = dt.Rows[0]["Description"].ToString();
         //add color to desc and button
         txtDescription.Attributes.Add("style", "background-color:" + dt.Rows[0]["ColorId"].ToString() + ";");
         btnNewNotes.Attributes.Add("style", "background-color:" + dt.Rows[0]["ColorId"].ToString() + ";");
         //------
         txtMailIdReminder.Text = dt.Rows[0]["ReminderTo"].ToString();
         txtDate.Text           = dt.Rows[0]["ReminderDateTime"].ToString() != "" ? Convert.ToDateTime(dt.Rows[0]["ReminderDateTime"].ToString()).ToString("dd-MM-yyyy") : "";
         //if (uId == Request.QueryString["user"])
         //{
         //    txtTitle.Enabled = true;
         //    txtDescription.Enabled = true;
         //    btnSaveNotes.Text = "Update";
         //    btnSaveNotes.Enabled = true;
         //    btnDeleteNotes.Enabled = true;
         //    btnDeleteNotes.Visible = true;
         //    txtMailTo.Enabled = true;
         //}
         //else
         //{
         // Request.QueryString["ed"] = "";
         txtTitle.Enabled       = false;
         txtDescription.Enabled = false;
         btnSaveNotes.Enabled   = false;
         btnDeleteNotes.Enabled = false;
         txtMailTo.Enabled      = false;
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Editing of Notes is not allowed');", true);
         //}
     }
     catch (System.Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not Update');", true);
     }
 }
Ejemplo n.º 11
0
 protected void SendMAil()
 {
     try
     {
         if (txtMailTo.Text != "")
         {
             objNotes      = new NotesClass();
             objNotes.User = Request.QueryString["user"];
             DataTable   dtUserMail = objNotes.GetEmployeeDetails();
             MailMessage mM         = new MailMessage();
             mM.From = new MailAddress(dtUserMail.Rows[0]["EmailID"].ToString());
             string[] MailTo = txtMailTo.Text.Split(';');
             foreach (string Mailid in MailTo)
             {
                 mM.To.Add(new MailAddress(Mailid));
             }
             mM.To.Add(dtUserMail.Rows[0]["EmailID"].ToString());
             mM.Subject = txtTitle.Text.Trim() + "-" + spIndex.InnerHtml;
             // string file = Server.MapPath("~/Files/") + hdfFile.Value;
             // mM.Attachments.Add(new System.Net.Mail.Attachment(file));
             mM.Body       = txtDescription.Text.Trim();
             mM.IsBodyHtml = true;
             mM.Body       = mM.Body.ToString().Replace("\n", "<br />");
             SmtpClient sC = new SmtpClient("192.9.200.214", 25);
             mM.Body += "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />This mail has been triggered to draw your attention on the respective ERP/Joomla module. Please login to respective module to see further details and file attachments";
             //   sC.Host = "192.9.200.214"; //"smtp-mail.outlook.com"// smtp.gmail.com
             //   sC.Port = 25; //587
             sC.DeliveryMethod        = SmtpDeliveryMethod.Network;
             sC.UseDefaultCredentials = false;
             sC.Credentials           = new NetworkCredential("*****@*****.**", "isgec");
             //sC.Credentials = new NetworkCredential("adskvaultadmin", "isgec@123");
             sC.EnableSsl = false;  // true
             sC.Timeout   = 10000000;
             sC.Send(mM);
             //  ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Mail has been sent');", true);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Please provide proper mail id and Content');", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Some technical issue Mail not sent');", true);
     }
 }
Ejemplo n.º 12
0
        private void GetNotes()
        {
            objNotes             = new NotesClass();
            objNotes.NotesHandle = Request.QueryString["handle"];
            objNotes.IndexValue  = Request.QueryString["index"];
            DataTable dt = objNotes.GetNotes();

            if (dt.Rows.Count > 0)
            {
                gvData.DataSource = dt;
                gvData.DataBind();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('No record found');", true);
            }
        }
Ejemplo n.º 13
0
 protected void btnSendMail_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtTo.Text != "")
         {
             objNotes      = new NotesClass();
             objNotes.User = Request.QueryString["AttachedBy"];
             DataTable   dtUserMail = objNotes.GetEmployeeDetails();
             MailMessage mM         = new MailMessage();
             mM.From = new MailAddress("*****@*****.**");
             // mM.To.Add(txtTo.Text.Trim());
             string[] MailTo = txtTo.Text.Split(';');
             foreach (string Mailid in MailTo)
             {
                 mM.To.Add(new MailAddress(Mailid));
             }
             mM.To.Add(dtUserMail.Rows[0]["EmailID"].ToString());
             mM.Subject = hdfFile.Value;
             string file = Server.MapPath("~/Files/") + hdfFile.Value;
             mM.Attachments.Add(new System.Net.Mail.Attachment(file));
             mM.Body       = hdfFile.Value;
             mM.IsBodyHtml = true;
             SmtpClient sC = new SmtpClient("192.9.200.214", 25);
             //   sC.Host = "192.9.200.214"; //"smtp-mail.outlook.com"// smtp.gmail.com
             //   sC.Port = 25; //587
             sC.DeliveryMethod        = SmtpDeliveryMethod.Network;
             sC.UseDefaultCredentials = false;
             sC.Credentials           = new NetworkCredential("*****@*****.**", "isgec");
             //sC.Credentials = new NetworkCredential("adskvaultadmin", "isgec@123");
             sC.EnableSsl = false;  // true
             sC.Timeout   = 10000000;
             sC.Send(mM);
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Mail has been sent');", true);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Please provide proper mail id');", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Some technical issue Mail not sent');", true);
     }
 }
Ejemplo n.º 14
0
 protected void lnkDeleteColor_Click(object sender, EventArgs e)
 {
     try
     {
         LinkButton lnkDelete     = (LinkButton)sender;
         string[]   Value         = lnkDelete.CommandArgument.Split('&');
         NotesClass objNotesClass = new NotesClass();
         objNotesClass.User = Value[1];
         int res = objNotesClass.DeleteUserColor();
         if (res > 0)
         {
             GEtUserColor();
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Deleted');", true);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Not Deleted');", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Some technical issue data Not Deleted');", true);
     }
 }
Ejemplo n.º 15
0
 protected void btnDeleteNotes_Click(object sender, EventArgs e)
 {
     try
     {
         objNotes        = new NotesClass();
         objNotes.NoteID = hdfNoteId.Value;
         int res = objNotes.DeleteNotes();
         if (res > 0)
         {
             txtTitle.Text       = "";
             txtDescription.Text = "";
             GetNotes();
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Successfully Deleted');", true);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Not Deleted ');", true);
         }
     }
     catch (System.Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue data Not deleted');", true);
     }
 }
Ejemplo n.º 16
0
        protected void btnAttachment_Click(object sender, EventArgs e)
        {
            try
            {
                string url;

                if (hdfNoteId.Value != "")
                {
                    if (hdfUser.Value == Request.QueryString["user"])
                    {
                        // Response.Redirect("Attachment.aspx?AthHandle=" + Request.QueryString["handle"] + "&Index=" + hdfNoteId.Value + "&AttachedBy=" + Request.QueryString["user"] + "&ed=y");
                        url = "Attachment.aspx?AthHandle=JOOMLA_NOTES" + "&Index=" + hdfNoteId.Value + "&AttachedBy=" + Request.QueryString["user"] + "&ed=y";
                    }
                    else
                    {
                        url = "Attachment.aspx?AthHandle=JOOMLA_NOTES" + "&Index=" + hdfNoteId.Value + "&AttachedBy=" + Request.QueryString["user"];
                    }
                    string s = "window.open('" + url + "', 'popup_window','width=900,height=800,left=100,top=100,resizable=yes');"; //, 'width=300,height=100,left=100,top=100,resizable=yes'
                    ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
                }
                else
                {
                    objNotes                  = new NotesClass();
                    objNotes.NotesHandle      = Request.QueryString["handle"];
                    objNotes.IndexValue       = Request.QueryString["index"];
                    objNotes.Title            = txtTitle.Text != "" ? txtTitle.Text.Trim() : "Only Attachment";
                    objNotes.Description      = txtDescription.Text != "" ? txtDescription.Text.Trim() : "Only Attachment";
                    objNotes.User             = Request.QueryString["user"];
                    objNotes.SendEmailTo      = txtMailTo.Text;
                    objNotes.RemiderMailId    = txtMailIdReminder.Text.Trim();
                    objNotes.ReminderDateTime = txtDate.Text != "" ? Convert.ToDateTime(txtDate.Text.Trim()).ToString("yyyy-MM-dd") + " " + "9:00" : System.DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + " " + "9:00";
                    //objNotes.ReminderDateTime =txtDate.Text!=""? Convert.ToDateTime(txtDate.Text.Trim()).ToString("yyyy-MM-dd") +" "+ txtTime.Text.Trim(): System.DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + " " + txtTime.Text.Trim();

                    DataTable dtNotesID = objNotes.Insertdata();

                    if (dtNotesID.Rows[0][0].ToString() != "0")
                    {
                        if (txtMailTo.Text != "")
                        {
                            SendMAil();
                        }

                        txtTitle.Text       = "";
                        txtDescription.Text = "";
                        GetNotes();
                        hdfNewNoteId.Value = dtNotesID.Rows[0][0].ToString();
                        objNotes           = new NotesClass();
                        string TempNoteId = objNotes.GetTempNoteID();
                        url = "Attachment.aspx?AthHandle=JOOMLA_NOTES" + "&Index=" + dtNotesID.Rows[0][0].ToString() + "&AttachedBy=" + Request.QueryString["user"] + "&ed=y";
                        string s = "window.open('" + url + "', 'popup_window','width=900,height=800,left=100,top=100,resizable=yes');"; //, 'width=300,height=100,left=100,top=100,resizable=yes'
                        ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Notes Handle does not exist');", true);
                    }
                }
            }
            catch (System.Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not Saved');", true);
            }
        }
Ejemplo n.º 17
0
        protected void btnSaveNotes_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTitle.Text != "" && txtDescription.Text != "")
                {
                    objNotes                  = new NotesClass();
                    objNotes.NotesHandle      = Request.QueryString["handle"];
                    objNotes.IndexValue       = Request.QueryString["index"];
                    objNotes.Title            = txtTitle.Text.Trim();
                    objNotes.Description      = txtDescription.Text.Trim();
                    objNotes.User             = Request.QueryString["user"];
                    objNotes.SendEmailTo      = txtMailTo.Text;
                    objNotes.RemiderMailId    = txtMailIdReminder.Text.Trim();
                    objNotes.ReminderDateTime = txtDate.Text != "" ? Convert.ToDateTime(txtDate.Text.Trim()).ToString("yyyy-MM-dd") + " " + "9:00" : System.DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + " " + "9:00";
                    //objNotes.ReminderDateTime =txtDate.Text!=""? Convert.ToDateTime(txtDate.Text.Trim()).ToString("yyyy-MM-dd") +" "+ txtTime.Text.Trim(): System.DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + " " + txtTime.Text.Trim();

                    if (btnSaveNotes.Text == "Submit")
                    {
                        if (hdfNewNoteId.Value == "")
                        {
                            DataTable dtNotesID = objNotes.Insertdata();
                            if (dtNotesID.Rows[0][0].ToString() != "0")
                            {
                                if (txtMailTo.Text != "")
                                {
                                    SendMAil();
                                }
                                txtTitle.Text       = "";
                                txtDescription.Text = "";
                                GetNotes();

                                ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Successfully Saved');", true);
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Notes Handle does not exist');", true);
                            }
                        }
                        else
                        {
                            objNotes.NoteID = hdfNewNoteId.Value;
                            int res = objNotes.UpdateNotes();
                            if (txtMailTo.Text != "")
                            {
                                SendMAil();
                            }
                            if (res > 0)
                            {
                                txtTitle.Text       = "";
                                txtDescription.Text = "";
                                hdfNewNoteId.Value  = "";
                                GetNotes();
                                ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Successfully Saved');", true);
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Not Updated');", true);
                            }
                        }
                    }

                    // Update
                    else
                    {
                        objNotes.NoteID = hdfNoteId.Value;
                        int res = objNotes.UpdateNotes();
                        if (txtMailTo.Text != "")
                        {
                            SendMAil();
                        }
                        if (res > 0)
                        {
                            GetNotes();
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Successfully Updated');", true);
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Not Updated');", true);
                        }
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Please Enter all fields');", true);
                }
            }
            catch (System.Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not Saved');", true);
            }
        }
Ejemplo n.º 18
0
        protected void btnAttachment_Click(object sender, EventArgs e)
        {
            try
            {
                string url;
                if (Request.QueryString["RefHandle"] != null && Request.QueryString["RefIndex"] != null)
                {
                    //  url = "http://localhost/Attachment/Attachment.aspx?AthHandle=JOOMLA_NOTES" + "&Index=Notes230&AttachedBy=" + Request.QueryString["user"] + "&ed=a&RefHandle=" + Request.QueryString["RefHandle"] + "&RefIndex=" + Request.QueryString["RefIndex"] + "&ed=y";
                    // url = "http://localhost/Attachment/Attachment.aspx?AthHandle=J_PREORDER_WORKFLOW" + "&Index=389&AttachedBy=" + Request.QueryString["u"] + "&ed=a&RefHandle=TRANSMITTALLINES_200&RefIndex=BOi000532_JB0973-50270100-027-0001_00";
                    url = "Attachment.aspx?AthHandle=J_PREORDER_WORKFLOW" + "&Index=" + Request.QueryString["Index"] + "&AttachedBy=" + Request.QueryString["user"] + "&ed=a&RefHandle=" + Request.QueryString["RefHandle"] + "&RefIndex=" + Request.QueryString["RefIndex"] + "";
                    string s = "window.open('" + url + "', 'popup_window','width=900,height=800,left=100,top=100,resizable=yes');"; //, 'width=300,height=100,left=100,top=100,resizable=yes'
                    ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
                }

                else if (Request.QueryString["RefHandle"] == null && Request.QueryString["RefIndex"] == null)
                {
                    if (hdfNoteId.Value != "")
                    {
                        //if (Request.QueryString["RefHandle"] != null && Request.QueryString["RefIndex"] != null && hdfUser.Value == Request.QueryString["user"])
                        //{
                        //    url = "http://localhost/Attachment/Attachment.aspx?AthHandle=JOOMLA_NOTES" + "&Index=" + hdfNoteId.Value + "&AttachedBy=" + Request.QueryString["user"] + "&ed=a&RefHandle=" + Request.QueryString["RefHandle"] + "&RefIndex=" + Request.QueryString["RefIndex"] + "&ed=y";

                        //}
                        //else
                        if (hdfUser.Value == Request.QueryString["user"])
                        {
                            if (txtTitle.Enabled)
                            {
                                url = "Attachment.aspx?AthHandle=JOOMLA_NOTES" + "&Index=" + hdfNoteId.Value + "&AttachedBy=" + Request.QueryString["user"] + "&ed=y";
                            }
                            // Response.Redirect("Attachment.aspx?AthHandle=" + Request.QueryString["handle"] + "&Index=" + hdfNoteId.Value + "&AttachedBy=" + Request.QueryString["user"] + "&ed=y");
                            url = "Attachment.aspx?AthHandle=JOOMLA_NOTES" + "&Index=" + hdfNoteId.Value + "&AttachedBy=" + Request.QueryString["user"] + "&ed=n";
                        }
                        else
                        {
                            url = "Attachment.aspx?AthHandle=JOOMLA_NOTES" + "&Index=" + hdfNoteId.Value + "&AttachedBy=" + Request.QueryString["user"];
                        }

                        string s = "window.open('" + url + "', 'popup_window','width=900,height=800,left=100,top=100,resizable=yes');"; //, 'width=300,height=100,left=100,top=100,resizable=yes'
                        ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
                    }

                    else
                    {
                        objNotes                  = new NotesClass();
                        objNotes.NotesHandle      = Request.QueryString["handle"];
                        objNotes.IndexValue       = Request.QueryString["index"];
                        objNotes.Title            = txtTitle.Text != "" ? txtTitle.Text.Trim() : "Only Attachment";
                        objNotes.Description      = txtDescription.Text != "" ? txtDescription.Text.Trim() : "Only Attachment";
                        objNotes.User             = Request.QueryString["user"];
                        objNotes.SendEmailTo      = txtMailTo.Text;
                        objNotes.RemiderMailId    = txtMailIdReminder.Text.Trim();
                        objNotes.ReminderDateTime = txtDate.Text != "" ? Convert.ToDateTime(txtDate.Text.Trim()).ToString("yyyy-MM-dd") + " " + "9:00" : System.DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + " " + "9:00";
                        //objNotes.ReminderDateTime =txtDate.Text!=""? Convert.ToDateTime(txtDate.Text.Trim()).ToString("yyyy-MM-dd") +" "+ txtTime.Text.Trim(): System.DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + " " + txtTime.Text.Trim();

                        //Session["NotesHandle"] = objNotes.NotesHandle;
                        //Session["IndexValue"] = objNotes.IndexValue;
                        //Session["Title"] = objNotes.Title;
                        //Session["Description"] = objNotes.Description;
                        //Session["User"] = objNotes.User;
                        //Session["SendEmailTo"] = objNotes.SendEmailTo;
                        //Session["RemiderMailId"] = objNotes.RemiderMailId;
                        //Session["ReminderDateTime"] = objNotes.ReminderDateTime;

                        DataTable dtNotesID = objNotes.Insertdata();

                        if (dtNotesID.Rows[0][0].ToString() != "0")
                        {
                            //if (txtMailTo.Text != "")
                            //{
                            //    SendMAil();
                            //}

                            // txtTitle.Text = "";
                            // txtDescription.Text = "";
                            // GetNotes();
                            hdfNewNoteId.Value = dtNotesID.Rows[0][0].ToString();
                            objNotes           = new NotesClass();
                            string TempNoteId = objNotes.GetTempNoteID();
                            url = "Attachment.aspx?AthHandle=JOOMLA_NOTES" + "&Index=" + dtNotesID.Rows[0][0].ToString() + "&AttachedBy=" + Request.QueryString["user"] + "&ed=y";
                            string s = "window.open('" + url + "', 'popup_window','width=900,height=800,left=100,top=100,resizable=yes');"; //, 'width=300,height=100,left=100,top=100,resizable=yes'
                            ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Notes Handle does not exist');", true);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not Saved');", true);
            }
        }