Esempio n. 1
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);
            }
        }
Esempio n. 2
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);
            }
        }