public static COMN_File GetFileByID(int id) { COMN_File COMN_File = new COMN_File(); SqlFileProvider sqlFileProvider = new SqlFileProvider(); COMN_File = sqlFileProvider.GetFileByID(id); return COMN_File; }
public COMN_File GetFileFromReader(IDataReader reader) { try { COMN_File file = new COMN_File ( (int)reader["FileID"], reader["FileContent"].ToString(), (int)reader["RowStatusID"], (DateTime)reader["AddedDate"], reader["AddedBy"].ToString() ); return file; } catch(Exception ex) { return null; } }
public bool UpdateFile(COMN_File file) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("CUC_UpdateFile", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@FileID", SqlDbType.Int).Value = file.FileID; cmd.Parameters.Add("@FileContent", SqlDbType.NText).Value = file.FileContent; cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = file.RowStatusID; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = file.AddedDate; cmd.Parameters.Add("@AddedBy", SqlDbType.UniqueIdentifier).Value = file.AddedBy; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public int InsertFile(COMN_File file) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("CUC_InsertFile", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@FileID", SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add("@FileContent", SqlDbType.NText).Value = file.FileContent; cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = file.RowStatusID; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = file.AddedDate; cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = file.AddedBy; connection.Open(); int result = cmd.ExecuteNonQuery(); return (int)cmd.Parameters["@FileID"].Value; } }
public static bool UpdateFile(COMN_File file) { SqlFileProvider sqlFileProvider = new SqlFileProvider(); return sqlFileProvider.UpdateFile(file); }
public static int InsertFile(COMN_File file) { SqlFileProvider sqlFileProvider = new SqlFileProvider(); return sqlFileProvider.InsertFile(file); }
protected void btnSubmit_Click(object sender, EventArgs e) { String printedString=@"<p class='MsoNormal' style='text-align:right;'> <b><br /><br /><br /><br /><br /><span>"; printedString+= "Issue Date- " + txtIssueDate.Text; printedString+=@" <o:p></o:p></span></b></p> <p class='MsoNormal'> <span><o:p> </o:p></span></p> <p class='MsoNormal'> <b><span>"; printedString+= "<b>To,</b><br/>"+txtTo.Text.Replace("\n","<br/>")+"<br />Subject: "+ txtSubject.Text; printedString+=@"<o:p></o:p></span></b></p> <p class='MsoNormal'> <b><span><o:p> </o:p></span></b></p> <p class='MsoNormal'> <b><span>"; printedString+= "Dear "+ txtDearTo.Text+@",<o:p></o:p></span></b></p> <p class='MsoNormal'>"; printedString+= txtP0_1.Text+"<b>"+txtDepartment.Text+" </b>"+txtP0_2.Text+" </p>"; printedString+=@"<p class='MsoNormal'>"+txtP1_1.Text+ txtJoiningDate.Text+" </b>"+txtP1_2.Text+"<b>"+ txtSalary.Text+"</b><span> </span>"+txtP1_3.Text+"<span><o:p></o:p></span></p><p class='MsoNormal'>"; printedString+=txtP2_1.Text+" <b>"+txtOfficeTime.Text+"</b>"+txtP2_2.Text+@"</p> <p class='MsoNormal'> "+txtP3.Text+@"</p> <p class='MsoNormal'> "+txtP4.Text+@"<b> </b><span> </span></p> <p class='MsoNormal'> "+txtP5.Text+@"</p> <p class='MsoNormal'> "+txtP6.Text+@"</p> <p class='MsoNormal'> <b> "+txtThanks.Text.Replace("\n", "<br/>")+"</b></p>"; //lblIssueDate.Text = "Issue Date- " + txtIssueDate.Text; //lblTo.Text = "<b>To,</b><br/>"+txtTo.Text.Replace("\n","<br/>"); //lblSubject.Text = "<br />Subject: "+ txtSubject.Text; //lblDearTo.Text ="Dear "+ txtDearTo.Text; //lblDepartment.Text = txtDepartment.Text; //lblJoiningDate.Text = txtJoiningDate.Text; //lblSalary.Text = txtSalary.Text; //lblOfficeTime.Text = txtOfficeTime.Text; //lblThanks.Text = txtThanks.Text.Replace("\n", "<br/>"); lnkPrint.Visible = true; appointmentLetter.Visible = true; //Fixed Text //lblP0_1.Text = txtP0_1.Text; //lblP0_2.Text = txtP0_2.Text; //lblP1_1.Text = txtP1_1.Text; //lblP1_2.Text = txtP1_2.Text; //lblP1_3.Text = txtP1_3.Text; //lblP2_1.Text = txtP2_1.Text; //lblP2_2.Text = txtP2_2.Text; //lblP3.Text = txtP3.Text; //lblP4.Text = txtP4.Text; //lblP5.Text = txtP5.Text; lblPrintedLetter.Text = printedString; if (chkSaveIndb.Checked) { COMN_File file = new COMN_File(); file.FileContent = printedString; file.RowStatusID = 1; file.AddedDate = DateTime.Now; try { file.AddedBy = HR_EmployeeManager.GetHR_EmployeeInfoByEmployeeNo(Request.QueryString["EmployeeNo"]).Tables[0].Rows[0]["EmployeeID"].ToString(); } catch (Exception ex) { file.AddedBy = Profile.card_id; } int resutl = COMN_FileManager.InsertFile(file); } }