public static enumErrorCode CheckAndReadStaffInfo(string filePath, List <StaffInfo> staffList) { OfficeExcel.Application excel = new OfficeExcel.Application(); excel.Visible = false; excel.UserControl = false; object missing = System.Reflection.Missing.Value; OfficeExcel.Workbook wb = excel.Application.Workbooks.Open(filePath, missing, true); OfficeExcel.Worksheet ws = (OfficeExcel.Worksheet)wb.Worksheets.get_Item(1); int rowCount = ws.UsedRange.Cells.Rows.Count; int columnCount = ws.UsedRange.Cells.Columns.Count; if (!(ws.Cells[1, 1].Text.ToString() == "姓名" && ws.Cells[1, 3].Text.ToString() == "工号" && ws.Cells[1, 6].Text.ToString() == "手机")) { return(enumErrorCode.ExcelHeadError); } for (int i = 2; i <= rowCount; i++) { StaffInfo staff = new StaffInfo(); ReadStaffInfo(ws.Cells, i, staff); staffList.Add(staff); } return(enumErrorCode.HandlerSuccess); }
static void Main(string[] args) { Console.WriteLine("rows -->影响数据的行数,-1 表示操作员编号已经存在 "); Console.WriteLine(); StaffInfo newstaffinfo = new StaffInfo(); newstaffinfo.StaffID = "3"; newstaffinfo.StaffName = "王大锤"; newstaffinfo.BelongDeptId = 2; DeptInfo newdeptinfo = new DeptInfo(); newdeptinfo.DeptID = 1; newdeptinfo.DeptName = "测试部"; newdeptinfo.DeptPhone = "12312312"; AddStaffMgr AddStaffmger = new AddStaffMgr(newstaffinfo); AddStaffmger.Execute(); StaffQueryMgr StaffQuery = new StaffQueryMgr(newstaffinfo.StaffID); StaffQuery.Execute(); List <StaffDeptInfo> staffDeptinfoList = StaffQuery.StaffDeptinfoList; DeleteStaffMgr DeleteStaff = new DeleteStaffMgr(newstaffinfo.StaffID); DeleteStaff.Execute(); UpdataStaffMgr UpdataStaff = new UpdataStaffMgr(newstaffinfo); UpdataStaff.Execute(); Console.ReadLine(); }
internal IEnumerable <StaffInfo> PopulateDataGrid() { string query = " Select a.StaffPin, a.StaffName, a.DOB, a.IsActive ,b.GenderID,b.GenderName from StaffInfo a Inner join Gender b ON a.GenderID=b.GenderID "; var dt = con.GetDataThroughDataTable(query, null); return(from DataRow row in dt.Rows select StaffInfo.ConvertToStaffInfo(row)); }
private void continueBtn_Click(object sender, EventArgs e) { if (nameTxtBox.Text != string.Empty && farmCmbBox.SelectedItem != null && taskCmbBox.SelectedItem != null) { AddStaff(); StaffInfo staff = new StaffInfo(); AddData(staff); if (!_staffList.Contains(staff)) { _staffList.Add(staff); } UpdateTable(staff); DisableControls(); } else { CustomMessageBox msBox = new CustomMessageBox("Error", "Please complete the details first!", CustomMessageBoxStatus.Alert); msBox.ShowDialog(); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,Surname,Email,FirstAider")] StaffInfo staffInfo) { if (id != staffInfo.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(staffInfo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StaffInfoExists(staffInfo.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(staffInfo)); }
public StaffInfo GetStaffOrgInfo(Guid userid) { StaffInfo model = null; var cmdText = @"select top 1 o.Id,o.Step from Staff s join UserInOrg uo on uo.UserId = s.UserId join OrgDepmt o on o.Id = uo.OrgId where s.UserId = @UserId "; var parm = new SqlParameter("@UserId", SqlDbType.UniqueIdentifier); parm.Value = userid; using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetDbConnString, CommandType.Text, cmdText, parm)) { if (reader != null) { if (reader.Read()) { model = new StaffInfo(); model.OrgId = reader.IsDBNull(0) ? Guid.Empty : reader.GetGuid(0); model.OrgStep = reader.IsDBNull(1) ? string.Empty : reader.GetString(1); } } } return(model); }
private void buttonPersonDelete_Click(object sender, RoutedEventArgs e) { var orgTemplate = this.gridOrgTemplate.DataContext as OrganizationTemplate; if (orgTemplate == null) { return; } StaffInfo selectedStaff = this.dataGridPersons.SelectedValue as StaffInfo; if (selectedStaff == null) { return; } if (MessageBox.Show("确实要删除选中的人员吗?", "删除提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { ObservableCollection <StaffInfo> staffInfos = this.dataGridPersons.ItemsSource as ObservableCollection <StaffInfo>; PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.PlanDatabase.I_CO_IA_Template>(channel => { channel.DeleteStaff(orgTemplate.Guid, new string[] { selectedStaff.Key }); }); staffInfos.Remove(selectedStaff); } }
private void btnAdd_Click(object sender, EventArgs e) { if (CheckInfo()) { StaffInfo sf = new StaffInfo() { StaffName = txtName.Text, StaffSex = cboSex.Text, StaffAge = Convert.ToInt32(cboAge.Text), StaffBirthday = Convert.ToDateTime(dtpBirthday.Text), StaffAddress = txtDress.Text == "" ? "无" : txtDress.Text, StaffTel = txtTel.Text, StaffCardId = txtCard.Text, EContact = txtEName.Text == "" ? "无" : txtEName.Text, EContactTel = txtETel.Text == "" ? "无" : txtETel.Text, TypeId = cboType.Text, }; StaffInfo nt = StaffManager.SelectStaffByCID(txtCard.Text); if (nt != null) { MessageBox.Show("身份证相同", "提示"); return; } int n = StaffManager.InsertStaff(sf); if (n > 0) { MessageBox.Show("添加成功!", "提示"); } else { MessageBox.Show("该员工已存在,添加失败", "提示"); } } }
public void InsertOrgStaff(StaffInfo model) { Insert(model); var userInOrgInfo = new UserInOrgInfo(model.AppCode, model.UserId, model.OrgId); _db.UserInOrg.Insert(userInOrgInfo); }
public StaffInfo InsertUpdateStaffInfo([FromBody] StaffInfo staffInfo) { try { if (ModelState.IsValid) { if (staffInfo.StaffInfoId == 0) { if (_userService.IsEmailAddressExists(staffInfo.Email)) { throw new Exception("Email address already Exists!!"); } } staffInfo.UpdateDate = DateTime.Now; staffInfo = _staffService.InsertUpdatedStaff(staffInfo); } } catch (Exception) { throw; } return(staffInfo); }
public ActionResult Create(StaffInfo staffInfo) { if (ModelState.IsValid) { IEnumerable <StaffInfo> tempStaff = from item in db.StaffInfo where item.Number == staffInfo.Number select item; if (tempStaff.Count() > 0) { ViewData["error"] = "【工号】 重复"; return(View(staffInfo)); } FactoryRoom roomItem = db.FactoryRoom.Single(item => item.RoomID == staffInfo.DeptId); staffInfo.DeptName = roomItem.RoomName; staffInfo.DeptNumber = roomItem.RoomNumber; //用户资料库 db.StaffInfo.Add(staffInfo); //同步管理账户 WebSecurity.CreateUserAndAccount(staffInfo.Number, staffInfo.Password); db.SaveChanges(); } return(View("Detail", staffInfo)); }
private void btnUpdate_Click(object sender, EventArgs e) { if (CheckInfo()) { StaffInfo sf = new StaffInfo() { StaffId = Convert.ToInt32(lblStaffId.Text), StaffName = txtName.Text, StaffSex = cboSex.Text, StaffAge = Convert.ToInt32(cboAge.Text), StaffBirthday = Convert.ToDateTime(dtpBirthday.Text), StaffAddress = txtDress.Text == "" ? "无" : txtDress.Text, StaffTel = txtTel.Text, StaffCardId = txtCard.Text, EContact = txtEName.Text == "" ? "无" : txtEName.Text, EContactTel = txtETel.Text == "" ? "无" : txtETel.Text, TypeId = cboType.Text, }; int n = StaffManager.UpdateStaff(sf); if (n > 0) { MessageBox.Show("修改成功!", "提示"); } else { MessageBox.Show("修改失败!", "提示"); } } }
private void btnSearchStaff_Click(object sender,EventArgs e) { string query = txtSearchStaff.Text.Trim().ToLower(); List <StaffInfo> data = new List <StaffInfo>(); DisplayStaff(); foreach (DataGridViewRow a in dgvStaffList.Rows) { if (a.Cells[0].Value.ToString().ToLower().Contains(query) || a.Cells[1].Value.ToString().ToLower().Contains(query) || a.Cells[2].Value.ToString().ToLower().Contains(query) || a.Cells[3].Value.ToString().ToLower().Contains(query) || a.Cells[4].Value.ToString().ToLower().Contains(query) || a.Cells[5].Value.ToString().ToLower().Contains(query) || a.Cells[6].Value.ToString().ToLower().Contains(query)) { StaffInfo x = new StaffInfo(); x.Id = Convert.ToInt32(a.Cells[0].Value); x.Name = a.Cells[1].Value.ToString(); x.DateOfBirth = a.Cells[2].Value.ToString(); x.Gender = a.Cells[3].Value.ToString(); x.Email = a.Cells[4].Value.ToString(); x.Phone = a.Cells[5].Value.ToString(); x.Address = a.Cells[6].Value.ToString(); data.Add(x); } } dgvStaffList.DataSource = data; }
public async Task <IActionResult> Edit(int id, [Bind("SsId,StaffId,StaffName,WorkingSector,Cell,Email,Address")] StaffInfo staffInfo) { if (id != staffInfo.SsId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(staffInfo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StaffInfoExists(staffInfo.SsId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["SsId"] = new SelectList(_context.StaffSalary, "SsId", "MonthName", staffInfo.SsId); return(View(staffInfo)); }
public int Update(StaffInfo model) { StringBuilder sb = new StringBuilder(500); sb.Append(@"update Staff set AppCode = @AppCode,Coded = @Coded,Named = @Named,Phone = @Phone,Sort = @Sort,Remark = @Remark,RecordDate = @RecordDate,LastUpdatedDate = @LastUpdatedDate where UserId = @UserId " ); SqlParameter[] parms = { new SqlParameter("@UserId", SqlDbType.UniqueIdentifier), new SqlParameter("@AppCode", SqlDbType.Char, 10), new SqlParameter("@Coded", SqlDbType.VarChar, 36), new SqlParameter("@Named", SqlDbType.NVarChar, 50), new SqlParameter("@Phone", SqlDbType.VarChar, 11), new SqlParameter("@Sort", SqlDbType.Int), new SqlParameter("@Remark", SqlDbType.NVarChar, 100), new SqlParameter("@RecordDate", SqlDbType.DateTime), new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime) }; parms[0].Value = model.UserId; parms[1].Value = model.AppCode; parms[2].Value = model.Coded; parms[3].Value = model.Named; parms[4].Value = model.Phone; parms[5].Value = model.Sort; parms[6].Value = model.Remark; parms[7].Value = model.RecordDate; parms[8].Value = model.LastUpdatedDate; return(SqlHelper.ExecuteNonQuery(SqlHelper.AssetDbConnString, CommandType.Text, sb.ToString(), parms)); }
public IList <StaffInfo> GetList() { StringBuilder sb = new StringBuilder(300); sb.Append(@"select UserId,AppCode,Coded,Named,Phone,Sort,Remark,RecordDate,LastUpdatedDate from Staff order by Sort " ); IList <StaffInfo> list = new List <StaffInfo>(); using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetDbConnString, CommandType.Text, sb.ToString())) { if (reader != null && reader.HasRows) { while (reader.Read()) { StaffInfo model = new StaffInfo(); model.UserId = reader.IsDBNull(0) ? Guid.Empty : reader.GetGuid(0); model.AppCode = reader.IsDBNull(1) ? string.Empty : reader.GetString(1); model.Coded = reader.IsDBNull(2) ? string.Empty : reader.GetString(2); model.Named = reader.IsDBNull(3) ? string.Empty : reader.GetString(3); model.Phone = reader.IsDBNull(4) ? string.Empty : reader.GetString(4); model.Sort = reader.IsDBNull(5) ? 0 : reader.GetInt32(5); model.Remark = reader.IsDBNull(6) ? string.Empty : reader.GetString(6); model.RecordDate = reader.IsDBNull(7) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(7); model.LastUpdatedDate = reader.IsDBNull(8) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(8); list.Add(model); } } } return(list); }
public ActionResult Delete(string id) { StaffInfo obj = new StaffInfo(); var staffInfo = bll.GetInfoById(id.PadLeft(8, '0')); obj = staffInfo; return(View(obj)); }
public async Task <IActionResult> EditStaff(Guid personId) { var person = await _unitOfWork.People.GetOneAsync(x => x.Id == personId, include : p => p.Include(w => w.StaffInfo)); var model = StaffInfo.Init(person); return(View(model)); }
public static int UpdatePasswordDataAccess(StaffInfo staffInfo) { string salt = Guid.NewGuid().ToString(); string psd = MD5Encoding(staffInfo.UserPassword + salt); var sql = $"update {STAFFTABLENAME} set userpassword = '******', salt = '{salt}' where userrecord = '{staffInfo.UserRecord}'"; return(SqlServerHelper.ExecuteNonQuery(CommandType.Text, sql, 30, null)); }
public void VerifyHourlyRateEqualTo50_OfStaff() { StaffInfo staffInfoObj = new StaffInfo(); //Passing values of Staff to get the result of Hourly Rate whether it is less than 50 or not int hourlyRateResult = staffInfoObj.Can_GetStaff_Detail("Sonam", 003, 50); //Verifying the value Assert.AreEqual(50, hourlyRateResult); }
public void VerifyHourlyRateNotExceed50_Staff() { StaffInfo staffInfoObj = new StaffInfo(); //Passing values of Staff to get the result of Hourly Rate whether it is less than 50 or not int hourlyRateResult = staffInfoObj.Can_GetStaff_Detail("Swarnim", 001, 30); //Verifying the value Assert.AreEqual(30, hourlyRateResult); }
public ActionResult Detail(int id) { StaffInfo staffInfo = db.StaffInfo.Find(id); if (staffInfo == null) { return(HttpNotFound()); } return(View(staffInfo)); }
/// <summary> /// 数据显示的函数 /// </summary> public override void DisplayData() { InitDictItem();//数据字典加载(公用) if (!string.IsNullOrEmpty(ID)) { this.Text = "编辑职员"; StaffInfo info = CallerFactory <IStaffService> .Instance.FindByID(ID); if (info != null) { tempInfo = info;//重新给临时对象赋值,使之指向存在的记录对象 txtNumber.Text = info.Number; txtName.Text = info.Name; luDepartment.SetSelected(info.DepartmentId); luCompany.SetSelected(info.CompanyId); luPosition.SetSelected(info.PositionId); cmbGender.Text = info.Gender; txtBirthday.SetDateTime(info.Birthday); txtNativePlace.Text = info.NativePlace; cmbNationality.Text = info.Nationality; txtIdentityCard.Text = info.IdentityCard; txtPhone.Text = info.Phone; txtOfficePhone.Text = info.OfficePhone; txtEmail.Text = info.Email; txtQQ.Text = info.QQ; txtHomeAddress.Text = info.HomeAddress; cmbPolitical.Text = info.Political; txtPartyDate.SetDateTime(info.PartyDate); cmbEducation.Text = info.Education; cmbDegree.Text = info.Degree; dpWorkingDate.SetDateTime(info.WorkingDate); cmbMarriage.Text = info.Marriage; cmbChildStatus.Text = info.ChildStatus; cmbTitles.Text = info.Titles; cmbDuty.Text = info.Duty; txtJobType.Text = info.JobType; txtIntroduce.Text = info.Introduce; txtRemark.Text = info.Remark; cmbEnabled.EditValue = info.Enabled; } //this.btnOK.Enabled = HasFunction("Staff/Edit"); } else { this.Text = "新增职员"; //this.btnOK.Enabled = Portal.gc.HasFunction("Staff/Add"); } //tempInfo在对象存在则为指定对象,新建则是全新的对象,但有一些初始化的GUID用于附件上传 //SetAttachInfo(tempInfo); }
public IList <StaffInfo> GetList(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms) { StringBuilder sb = new StringBuilder(500); sb.Append(@"select count(*) from Staff "); if (!string.IsNullOrEmpty(sqlWhere)) { sb.AppendFormat(" where 1=1 {0} ", sqlWhere); } totalRecords = (int)SqlHelper.ExecuteScalar(SqlHelper.AssetDbConnString, CommandType.Text, sb.ToString(), cmdParms); if (totalRecords == 0) { return(new List <StaffInfo>()); } sb.Clear(); int startIndex = (pageIndex - 1) * pageSize + 1; int endIndex = pageIndex * pageSize; sb.Append(@"select * from(select row_number() over(order by Sort) as RowNumber, UserId,AppCode,Coded,Named,Phone,Sort,Remark,RecordDate,LastUpdatedDate from Staff " ); if (!string.IsNullOrEmpty(sqlWhere)) { sb.AppendFormat(" where 1=1 {0} ", sqlWhere); } sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex); IList <StaffInfo> list = new List <StaffInfo>(); using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetDbConnString, CommandType.Text, sb.ToString(), cmdParms)) { if (reader != null && reader.HasRows) { while (reader.Read()) { StaffInfo model = new StaffInfo(); model.UserId = reader.IsDBNull(1) ? Guid.Empty : reader.GetGuid(1); model.AppCode = reader.IsDBNull(2) ? string.Empty : reader.GetString(2); model.Coded = reader.IsDBNull(3) ? string.Empty : reader.GetString(3); model.Named = reader.IsDBNull(4) ? string.Empty : reader.GetString(4); model.Phone = reader.IsDBNull(5) ? string.Empty : reader.GetString(5); model.Sort = reader.IsDBNull(6) ? 0 : reader.GetInt32(6); model.Remark = reader.IsDBNull(7) ? string.Empty : reader.GetString(7); model.RecordDate = reader.IsDBNull(8) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(8); model.LastUpdatedDate = reader.IsDBNull(9) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(9); list.Add(model); } } } return(list); }
//private void CompareCardId(List<StaffInfo> NewUserList, List<StaffInfo> OldUserList, out List<StaffInfo> OutAddList, out List<StaffInfo> OutDelList) //{ // List<StaffInfo> AddList = new List<StaffInfo>(); // List<StaffInfo> DelList = new List<StaffInfo>(); // StaffInfo info; // bool IsFind; // string CompareData = ""; // if (NewUserList.Count != 0) // { // for (int i = 0; i < NewUserList.Count; i++) // { // IsFind = false; // CompareData = NewUserList[i].ID; // for (int k = 0; k < OldUserList.Count; k++) // { // if (CompareData == OldUserList[k].ID && NewUserList[i].Name == OldUserList[k].Name) // { // IsFind = true; // break; // } // } // if (!IsFind) // { // info = new StaffInfo(); // info.ID = NewUserList[i].ID; // info.Name = NewUserList[i].Name; // AddList.Add(info); // } // } // for (int i = 0; i < OldUserList.Count; i++) // { // IsFind = false; // CompareData = OldUserList[i].ID; // for (int k = 0; k < NewUserList.Count; k++) // { // if (CompareData == NewUserList[k].ID) // { // IsFind = true; // break; // } // } // if (!IsFind) // { // info = new StaffInfo(); // info.ID = OldUserList[i].ID; // info.Name = OldUserList[i].Name; // DelList.Add(info); // } // } // } // else // { // DelList = OldUserList; // } // OutAddList = AddList; // OutDelList = DelList; //} private void CompareCardId(List <StaffInfo> NewUserList, List <StaffInfo> OldUserList, out List <StaffInfo> OutAddList, out List <StaffInfo> OutDelList) { List <StaffInfo> AddList = new List <StaffInfo>(); List <StaffInfo> DelList = new List <StaffInfo>(); StaffInfo info; bool IsFind; if (NewUserList.Count != 0) { foreach (var a in NewUserList) { IsFind = false; foreach (var b in OldUserList) { if (a.ID == b.ID && a.Name == b.Name) { IsFind = true; break; } } if (!IsFind) { info = new StaffInfo(); info.ID = a.ID; info.Name = a.Name; AddList.Add(info); } } foreach (var c in OldUserList) { IsFind = false; foreach (var d in NewUserList) { if (c.ID == d.ID) { IsFind = true; break; } } if (!IsFind) { info = new StaffInfo(); info.ID = c.ID; info.Name = c.Name; DelList.Add(info); } } } else { DelList = OldUserList; } OutAddList = AddList; OutDelList = DelList; }
public int Insert(StaffInfo model) { if (model.Id.Equals(Guid.Empty)) { model.Id = Guid.NewGuid(); } _db.Staffs.Insert(model); return(1); }
public async Task <IActionResult> Create([Bind("Id,FirstName,Surname,Email,FirstAider")] StaffInfo staffInfo) { if (ModelState.IsValid) { _context.Add(staffInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(staffInfo)); }
public async Task <IActionResult> EditStaffOtherInformation(Guid personId) { var person = await _unitOfWork.People.GetOneAsync(x => x.Id == personId, include : p => p.Include(w => w.StaffInfo).Include(x => x.PersonToClasses)); var classes = await _unitOfWork.Classes.GetAsync(x => x.OrganizationId == _organizationId && x.IsActive); var model = StaffInfo.Init(person, classes); return(View(model)); }
public static int InsertStaff(StaffInfo s) { int n = 0; string sql = "insert into StaffInfo(StaffName,StaffSex,StaffAge,StaffBirthday,"; sql += "StaffTel,StaffCardId,TypeId,StaffAddress,EContact,EContactTel) "; sql += "values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')"; sql = string.Format(sql, s.StaffName, s.StaffSex, s.StaffAge, s.StaffBirthday, s.StaffTel , s.StaffCardId, s.TypeId, s.StaffAddress, s.EContact, s.EContactTel); n = DBHelper.ExecuteNonQuery(sql); return(n); }
public async Task <IActionResult> Create([Bind("SsId,StaffId,StaffName,WorkingSector,Cell,Email,Address")] StaffInfo staffInfo) { if (ModelState.IsValid) { _context.Add(staffInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["SsId"] = new SelectList(_context.StaffSalary, "SsId", "MonthName", staffInfo.SsId); return(View(staffInfo)); }
public void ChangeDispatcherState(StaffInfo staff, long Id, DocumentDepatcherState state) { try { if (staff == null || Id <= 0 && state == null) { throw new ArgumentException("argument is wrong"); } SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@reciever", SqlDbType.Int, staff.Id); sql.AddParameter("@Id", SqlDbType.BigInt, Id); sql.AddParameter("@State", SqlDbType.Int, (int)state); sql.ExecuteSql(Sql_ChangeDispatcherState); } catch (Exception ex) { throw ex; } }
public IEnumerable<Document> GetDocument(StaffInfo staff, DocumentState state) { IList<Core.Business.Document> documentlist = new List<Core.Business.Document>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@id", SqlDbType.Int, staff.Id); sql.AddParameter("@state", SqlDbType.Int, state.ToCode()); SqlDataReader reader = sql.ExecuteSqlReader(Sql_GetDocument); if (reader != null) { while (reader.Read()) { Core.Business.Document document = new Core.Business.Document(); if (!reader.IsDBNull(0)) document.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) document.Title = reader.GetString(1); if (!reader.IsDBNull(2)) document.SubTitle = reader.GetString(2); if (!reader.IsDBNull(3)) document.Content = reader.GetString(3); if (!reader.IsDBNull(4)) document.SendDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) document.State = reader.GetInt32(5); if (!reader.IsDBNull(6)) document.Secret = reader.GetInt32(6); if (!reader.IsDBNull(7)) document.Mergency = reader.GetInt32(7); if (!reader.IsDBNull(8)) document.DraftDate = reader.GetDateTime(8); if (!reader.IsDBNull(9)) document.Sender = reader.GetInt32(9); document.MarkOld(); documentlist.Add(document); } reader.Close(); } return documentlist.AsEnumerable(); }
public Document Load(StaffInfo staff) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.BigInt, staff.Id); SqlDataReader reader = sql.ExecuteSqlReader(Sql_Load); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Document document = new Core.Business.Document(); if (!reader.IsDBNull(0)) document.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) document.Title = reader.GetString(1); if (!reader.IsDBNull(2)) document.SubTitle = reader.GetString(2); if (!reader.IsDBNull(3)) document.Content = reader.GetString(3); if (!reader.IsDBNull(4)) document.SendDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) document.State = reader.GetInt32(5); if (!reader.IsDBNull(6)) document.Secret = reader.GetInt32(6); if (!reader.IsDBNull(7)) document.Mergency = reader.GetInt32(7); if (!reader.IsDBNull(8)) document.DraftDate = reader.GetDateTime(8); if (!reader.IsDBNull(9)) document.Sender = reader.GetInt32(9); document.MarkOld(); reader.Close(); return document; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IEnumerable<Document> GetRecycles(StaffInfo staff) { IList<Core.Business.Document> documentlist = new List<Core.Business.Document>(); SqlServerUtility sql = new SqlServerUtility(); //sql.AddParameter("@state1", SqlDbType.Int, (int)CY.GFive.Core.Business.DocumentState.Removed); //sql.AddParameter("@state2", SqlDbType.Int, (int)CY.GFive.Core.Business.DocumentDepatcherState.Removed); //sql.AddParameter("@id1", SqlDbType.Int, staff.Id); //sql.AddParameter("@id2", SqlDbType.Int, staff.Id); SqlDataReader reader = sql.ExecuteSqlReader(string.Format(Sql_GetRecycles, staff.Id, DocumentState.Removed.ToCode(), DocumentDepatcherState.Removed.ToCode())); if (reader != null) { while (reader.Read()) { Core.Business.Document document = new Core.Business.Document(); if (!reader.IsDBNull(0)) document.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) document.Title = reader.GetString(1); if (!reader.IsDBNull(2)) document.SubTitle = reader.GetString(2); if (!reader.IsDBNull(3)) document.Content = reader.GetString(3); if (!reader.IsDBNull(4)) document.SendDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) document.State = reader.GetInt32(5); if (!reader.IsDBNull(6)) document.Secret = reader.GetInt32(6); if (!reader.IsDBNull(7)) document.Mergency = reader.GetInt32(7); if (!reader.IsDBNull(8)) document.DraftDate = reader.GetDateTime(8); if (!reader.IsDBNull(9)) document.Sender = reader.GetInt32(9); document.MarkOld(); documentlist.Add(document); } reader.Close(); } return documentlist; }
public IEnumerable<Document> GetRecieved(StaffInfo staff) { if (staff == null) throw new ArgumentNullException("staff is null"); IList<Core.Business.Document> documentlist = new List<Core.Business.Document>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@id", SqlDbType.Int, staff.Id); SqlDataReader reader = sql.ExecuteSqlReader(Sql_GetRecieved); if (reader != null) { while (reader.Read()) { Core.Business.Document document = new Core.Business.Document(); if (!reader.IsDBNull(0)) document.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) document.Title = reader.GetString(1); if (!reader.IsDBNull(2)) document.SubTitle = reader.GetString(2); if (!reader.IsDBNull(3)) document.Content = reader.GetString(3); if (!reader.IsDBNull(4)) document.SendDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) document.State = reader.GetInt32(5); if (!reader.IsDBNull(6)) document.Secret = reader.GetInt32(6); if (!reader.IsDBNull(7)) document.Mergency = reader.GetInt32(7); if (!reader.IsDBNull(8)) document.DraftDate = reader.GetDateTime(8); if (!reader.IsDBNull(9)) document.Sender = reader.GetInt32(9); //if (!reader.IsDBNull(10)) document.DispatchState = reader.GetInt32(10); documentlist.Add(document); } reader.Close(); } return documentlist.AsEnumerable(); }