public void CreateOfficial(Official official) { using (SqlConnection connection = base.GetConnection()) { SqlCommand command = new SqlCommand("_OfficialUpdate", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@Type", 0); command.Parameters.AddWithValue("@OfficialID", 0); command.Parameters.AddWithValue("@CateOfficialID", official.CateOfficialID); command.Parameters.AddWithValue("@NoCode", official.NoCode); command.Parameters.AddWithValue("@OfficialName", official.OfficialName); command.Parameters.AddWithValue("@DatePublic", official.DatePublic); command.Parameters.AddWithValue("@Company", official.Company); command.Parameters.AddWithValue("@Classify", official.Classify); command.Parameters.AddWithValue("@Writer", official.Writer); command.Parameters.AddWithValue("@Quote", official.Quote); command.Parameters.AddWithValue("@KeyShort", official.KeyShort); command.Parameters.AddWithValue("@Attached", official.Attached); command.Parameters.AddWithValue("@Status", official.Status); command.Parameters.AddWithValue("@ApprovalDate", official.ApprovalDate); command.Parameters.AddWithValue("@ApprovalUserName", official.ApprovalUserName); command.Parameters.AddWithValue("@IsApproval", official.IsApproval); command.Parameters.AddWithValue("@CreatedUserName", official.CreatedUserName); command.Parameters.AddWithValue("@CreatedDate", official.CreatedDate); connection.Open(); if (command.ExecuteNonQuery() <= 0) { throw new DataAccessException("Khong them moi duoc official"); } command.Dispose(); } }
public void CreateOfficial(Official official) { new OfficialDAO().CreateOfficial(official); }
public void UpdateOfficial(Official official) { new OfficialDAO().UpdateOfficial(official); }
private Official ReceiveHtml() { //string path = Request.PhysicalApplicationPath.Replace(@"\", "/") + "/Upload/Files/"; //commonBSO commonBSO = new commonBSO(); //string file_upload = commonBSO.UploadFile(file_attached, path, 18000000000); Official official = new Official(); official.OfficialID = (hddOfficialID.Value != "") ? Convert.ToInt32(hddOfficialID.Value) : 0; official.CateOfficialID = Convert.ToInt32(ddlCateNews.SelectedValue); official.NoCode = txtNoCode.Text; official.OfficialName = txtOfficialName.Text; official.DatePublic = txtRadDate.SelectedDate.Value; official.Company = txtCompany.Text; official.Classify = txtClassify.Text; official.Writer = txtAuthor.Text; official.Quote = txtQuote.Html; official.KeyShort = txtKeyShort.Text; // official.Attached = (file_upload != "") ? file_upload : hddfile_attached.Value; official.Attached = ""; official.Status = Convert.ToBoolean(rdbStatus.SelectedValue); official.IsApproval = true; official.ApprovalDate = DateTime.Now; official.ApprovalUserName = Session["Admin_UserName"].ToString(); official.CreatedDate = DateTime.Now; official.CreatedUserName = Session["Admin_UserName"].ToString(); return official; }