コード例 #1
0
 private void GetNotes()
 {
     try
     {
         objProjectCls = new ProjectClass();
         string sProjId          = (string)(Session["projId"]);
         string sLogisticCompany = objProjectCls.GetLogisticCompany(sProjId);
         objProjectCls.NotesHandle      = "T_ERECTIONACTIVITY_" + sLogisticCompany + "";
         objProjectCls.AttachmentHandle = "T_ERECTIONACTIVITY_" + sLogisticCompany + "";
         objProjectCls.IndexValue       = hdfNoteId.Value;
         //DataTable dt = objProjectCls.GetNotesFromASPNETUSer();
         DataTable dt = objProjectCls.GetNotes();
         if (dt.Rows.Count > 0)
         {
             rptNotes.DataSource = dt;
             rptNotes.DataBind();
         }
         else
         {
             //ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('No record found');", true);
         }
         // DataTable dtAttach = objProjectCls.GetAllAttachments();
         DataTable dtAttach = objProjectCls.GetAttachments();
         if (dtAttach.Rows.Count > 0)
         {
             gvAttachment.DataSource = dtAttach;
             gvAttachment.DataBind();
             divNoRecord.Visible       = false;
             divViewAttachment.Visible = true;
         }
         else
         {
             divNoRecord.Visible       = true;
             divViewAttachment.Visible = false;
         }
     }
     catch (Exception ex)
     {
     }
 }
コード例 #2
0
 private void BindData()
 {
     try
     {
         DataTable dt        = new DataTable();
         string    sUsername = (string)(Session["Username"]);
         // sUsername = "******";// for testing only
         //if (Request.QueryString["user"] != null)
         if (sUsername != null)
         {
             objProjectCls = new ProjectClass();
             string sProjId          = (string)(Session["projId"]);
             string sLogisticCompany = objProjectCls.GetLogisticCompany(sProjId);
             objProjectCls.IndexValue       = hdfNoteId.Value;
             objProjectCls.AttachmentHandle = "T_ERECTIONACTIVITY_" + sLogisticCompany + "";
             dt = objProjectCls.GetAttachments();
             if (dt.Rows.Count > 0)
             {
                 gvAttachment.DataSource = dt;
                 gvAttachment.DataBind();
                 divNoRecord.Visible       = false;
                 divViewAttachment.Visible = true;
             }
             else
             {
                 divNoRecord.Visible       = true;
                 divViewAttachment.Visible = false;
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('No Data found');", true);
         }
     }
     catch (System.Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not found');", true);
     }
 }
コード例 #3
0
        protected void btnSaveNotes_Click(object sender, EventArgs e)
        {
            try
            {
                string sUsername = (string)(Session["Username"]);

                //  sUsername = "******"; // for testing only
                if (txtTitle.Text != "" && txtNotesDescription.Text != "")
                {
                    objProjectCls = new ProjectClass();
                    string sProjId          = (string)(Session["projId"]);
                    string sLogisticCompany = objProjectCls.GetLogisticCompany(sProjId);
                    objProjectCls.NotesHandle = "T_ERECTIONACTIVITY_" + sLogisticCompany + "";
                    objProjectCls.IndexValue  = hdfNoteId.Value;
                    //Request.QueryString["cprj"].ToString() + "_" + Request.QueryString["cact"];
                    //hdfWFID.Value;
                    objProjectCls.Title       = txtTitle.Text.Trim();
                    objProjectCls.Description = txtNotesDescription.Text.Trim();
                    //objProjectCls.User = Request.QueryString["user"];
                    objProjectCls.User             = sUsername;
                    objProjectCls.SendEmailTo      = txtMailTo.Text;
                    objProjectCls.RemiderMailId    = "";
                    objProjectCls.ReminderDateTime = "";
                    //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")
                    {
                        DataTable dtNotesID = objProjectCls.Insertdata();
                        if (dtNotesID.Rows[0][0].ToString() != "0")
                        {
                            SendMAil(sUsername);
                            UploadAttachment(objProjectCls.IndexValue);
                            txtTitle.Text            = "";
                            txtNotesDescription.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);
                        }
                    }

                    // Update
                    else
                    {
                        objProjectCls.NoteID = hdfNoteId.Value;
                        int res = objProjectCls.UpdateNotes();
                        SendMAil(sUsername);
                        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);
            }
        }