protected void Page_Load(object sender, EventArgs e) { var type = new SysSettingBLL().GetValueById(SysSettingEnum.CRM_OPPORTUNITY_LOSS_REASON); int value = 0; if (!int.TryParse(type, out value)) { needReasonType = DicEnum.SYS_CLOSE_OPPORTUNITY.NEED_NONE; } else { needReasonType = (DicEnum.SYS_CLOSE_OPPORTUNITY)value; } if (needReasonType != DicEnum.SYS_CLOSE_OPPORTUNITY.NEED_NONE) { var list = new GeneralBLL().GetDicValues(GeneralTableEnum.OPPORTUNITY_LOSS_REASON_TYPE); LossReasonList.DataTextField = "show"; LossReasonList.DataValueField = "val"; LossReasonList.DataSource = list; LossReasonList.DataBind(); LossReasonList.Items.Insert(0, new ListItem() { Value = "", Text = " ", Selected = true }); } if (IsPostBack) { if (needReasonType == DicEnum.SYS_CLOSE_OPPORTUNITY.NEED_TYPE_DETAIL) { lossReason = DNRequest.GetQueryStringValue("LossReasonDetail", ""); } } }
/// <summary> /// 根据部门获取相对应的工作类型 /// </summary> private void GetWorkType(HttpContext context, long department_id) { var dccDal = new d_cost_code_dal(); var workTypeList = dccDal.GetCostCodeByWhere((int)DicEnum.COST_CODE_CATE.GENERAL_ALLOCATION_CODE, " and department_id =" + department_id); StringBuilder workTypeString = new StringBuilder(); workTypeString.Append("<option value='0'> </option>"); if (workTypeList != null && workTypeList.Count > 0) { foreach (var workType in workTypeList) { string billed = workType.show_on_invoice == (int)DicEnum.SHOW_ON_INVOICE.SHOW_DISBILLED ? "" : "(不计费)"; workTypeString.Append($"<option value='{workType.id}'>{workType.name}{billed}</option>"); } } var thisSet = new SysSettingBLL().GetSetById(SysSettingEnum.ALL_USER_ASSIGN_NODE_TOTAASL); if (thisSet != null && thisSet.setting_value == "1") { var noDepWorkTypeList = dccDal.GetCostCodeByWhere((int)DicEnum.COST_CODE_CATE.GENERAL_ALLOCATION_CODE, " and department_id is null"); if (noDepWorkTypeList != null && noDepWorkTypeList.Count > 0) { workTypeString.Append("<option value='0'>--------</option>"); foreach (var workType in noDepWorkTypeList) { string billed = workType.show_on_invoice == (int)DicEnum.SHOW_ON_INVOICE.SHOW_DISBILLED ? "" : "(不计费)"; workTypeString.Append($"<option value='{workType.id}'>{workType.name}{billed}</option>"); } } } context.Response.Write(workTypeString.ToString()); }
/// <summary> /// 根据不同的报价项选择不同的物料代码(执行不同的jquery代码放到前端执行) /// </summary> /// <returns></returns> private string ReturnJquery() { var scriptText = ""; if (proAndOneTimeItem != null && proAndOneTimeItem.Count > 0) { foreach (var item in proAndOneTimeItem) { if (item.object_id != null) { var product = new EMT.DoneNOW.BLL.ProductBLL().GetProduct((long)item.object_id); if (product != null) { scriptText += $"$('#{item.id}_select').val({product.cost_code_id});"; } } } } // SHIPITEM_COSTCODE_CLOSE if (shipItem != null && shipItem.Count > 0) { var sysSet = new SysSettingBLL().GetSetById(SysSettingEnum.SHIPITEM_COSTCODE_CLOSE); foreach (var item in shipItem) { if (item.object_id != null) { var thisGeneral = new d_general_dal().GetGeneralById((long)item.object_id); if (thisGeneral.parent_id != null) { scriptText += $"$('#{item.id}_select').val({thisGeneral.parent_id});"; } } else if (sysSet != null && (!string.IsNullOrEmpty(sysSet.setting_value))) { scriptText += $"$('#{item.id}_select').val({sysSet.setting_value});"; } } } if (degressionItem != null && degressionItem.Count > 0) { foreach (var item in proAndOneTimeItem) { if (item.object_id != null) { scriptText += $"$('#{item.id}_select').val({item.object_id});"; } } } return(scriptText); }
private void buttonX1_Click_1(object sender, EventArgs e) { if (Text.Equals("添加类别名称")) { sys_dict dict = new sys_dict(); dict.category_name = textBoxX1.Text; dict.dict_name = SysDictTypeConvert.CToE(labelX3.Text); SysSettingBLL set = new SysSettingBLL(); Result result = new Result(); result = set.Add(dict); if (result.Message == "添加成功!") { MessageBoxCustom.Show("添加成功", "提示", this); } else { MessageBoxCustom.Show("添加失败", "提示", this); } } else { sys_dict dict = new sys_dict(); dict.dict_name = SysDictTypeConvert.CToE(labelX3.Text); dict.category_name = textBoxX1.Text; dict.id = number; SysSettingBLL set = new SysSettingBLL(); Result result = new Result(); result = set.Update(dict); if (result.Message == "修改成功!") { MessageBoxCustom.Show("修改成功", "提示", this); } else { MessageBoxCustom.Show("修改失败", "提示", this); } } }
//系统设置Tab页点击事件(二级) private void TabSysSet_Click(object sender, EventArgs e) { DgvSysSet.AutoGenerateColumns = false; var ds = new SysSettingBLL().SeleteAll(); foreach (var item in ds) { if (item.dict_name.Equals(sys_dict_type.Cost.ToString())) { item.dict_name = "费用类别"; } else if (item.dict_name.Equals(sys_dict_type.Person.ToString())) { item.dict_name = "重点人员类别"; } else if (item.dict_name.Equals(sys_dict_type.BelongPlace.ToString())) { item.dict_name = "归属地"; } } DgvSysSet.DataSource = ds; }
private void CmbDictType_SelectedValueChanged_1(object sender, EventArgs e) { string a = CmbDictType.SelectedItem.ToString(); var ds = new SysSettingBLL().SelectByDictName(SysDictTypeConvert.Change(a)); foreach (var item in ds) { if (item.dict_name.Equals(sys_dict_type.Cost.ToString())) { item.dict_name = "费用类别"; } else if (item.dict_name.Equals(sys_dict_type.Person.ToString())) { item.dict_name = "重点人员类别"; } else if (item.dict_name.Equals(sys_dict_type.BelongPlace.ToString())) { item.dict_name = "归属地"; } } DgvSysSet.AutoGenerateColumns = false; DgvSysSet.DataSource = ds; }
private void BtnDelType_Click(object sender, EventArgs e) { if (CmbDictType.SelectedItem == null) { MessageBox.Show("请先选择一个数据字典"); } else { List <int> list3 = new List <int>(); list3 = SelectSettingId(); if (list3.Count == 0) { MessageBox.Show("请勾选数据字典"); } else { DialogResult = MessageBoxCustom.Show("已经使用的数据字典系统自动保留,确认删除?", "操作确认", MessageBoxButtons.YesNo, this); if (DialogResult == DialogResult.Yes) { SysSettingBLL set = new SysSettingBLL(); Result result = new Result(); result = set.DelAll(list3); if (result.Code == RES.OK) { MessageBoxCustom.Show("删除成功", "提示", this); } else { MessageBoxCustom.Show("删除失败", "提示", this); } CmbDictType_SelectedValueChanged_1(sender, e); } } } }
protected bool noTime = false; // 可以不输入开始结束时间(根据系统设置进行判断) protected void Page_Load(object sender, EventArgs e) { try { // 是否需要输入开始结束时间 var isNeedTimeString = Request.QueryString["NoTime"]; var noTimeSet = new SysSettingBLL().GetSetById(SysSettingEnum.SDK_ENTRY_REQUIRED); if (!string.IsNullOrEmpty(isNeedTimeString)) { if (noTimeSet != null && noTimeSet.setting_value == "0") { noTime = true; } } var callId = Request.QueryString["callId"]; if (!string.IsNullOrEmpty(callId)) { thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(callId)); } thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId()); var resList = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value as List <DictionaryEntryDto>; if (!IsPostBack) { resource_id.DataTextField = "show"; resource_id.DataValueField = "val"; var entryProxySet = new SysSettingBLL().GetValueById(SysSettingEnum.SDK_ENTRY_PROXY); bool isAgent = false; if (entryProxySet == ((int)DicEnum.PROXY_TIME_ENTRY.DISABLED).ToString()) { if (resList != null && resList.Count > 0) { resList = resList.Where(_ => _.val == LoginUserId.ToString()).ToList(); } } else { var agentResList = new UserResourceBLL().GetAgentUser(LoginUserId, out isAgent); if (agentResList != null && agentResList.Count > 0) { resList = (from a in agentResList select new DictionaryEntryDto() { val = a.id.ToString(), show = a.name }).ToList(); } } resource_id.DataSource = resList; resource_id.SelectedValue = LoginUserId.ToString(); resource_id.DataBind(); var statusList = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value as List <DictionaryEntryDto>; //statusList.Remove(statusList.FirstOrDefault(_=>_.val==((int)DicEnum.TICKET_STATUS.NEW).ToString())); status_id.DataTextField = "show"; status_id.DataValueField = "val"; status_id.DataSource = statusList; status_id.DataBind(); cost_code_id.DataTextField = "name"; cost_code_id.DataValueField = "id"; cost_code_id.DataSource = new d_cost_code_dal().GetCostCodeByWhere((int)DicEnum.COST_CODE_CATE.GENERAL_ALLOCATION_CODE); cost_code_id.DataBind(); notify_id.DataTextField = "name"; notify_id.DataValueField = "id"; notify_id.DataSource = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.TICKET_TIME_ENTRY_CREATED_EDITED); notify_id.DataBind(); } var taskId = Request.QueryString["task_id"]; if (!string.IsNullOrEmpty(taskId)) { thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId)); } var id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { thisWorkEntry = new sdk_work_entry_dal().FindNoDeleteById(long.Parse(id)); if (thisWorkEntry != null) { if (thisWorkEntry.approve_and_post_date != null || thisWorkEntry.approve_and_post_user_id != null) { Response.Write("<script>alert('审批提交的工时不可以更改!');window.close();</script>"); Response.End(); } if (!resList.Any(_ => _.val == thisWorkEntry.create_user_id.ToString())) { Response.Write("<script>alert('系统设置不能代理操作!');window.close();</script>"); return; } if (thisWorkEntry.end_time == null && noTimeSet != null && noTimeSet.setting_value == "0") { noTime = true; } entryList = new sdk_work_entry_dal().GetBatchList(thisWorkEntry.batch_id); isAdd = false; thisTask = new sdk_task_dal().FindNoDeleteById(thisWorkEntry.task_id); if (!IsPostBack) { resource_id.ClearSelection(); resource_id.SelectedValue = ((long)thisWorkEntry.resource_id).ToString(); cost_code_id.SelectedValue = ((long)thisWorkEntry.cost_code_id).ToString(); // status_id.SelectedValue = ((long)thisWorkEntry.) // thisTask = new crm_account_dal().FindNoDeleteById(thisWorkEntry.); } if (thisWorkEntry.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisWorkEntry.contract_id); } if (!IsPostBack) { isBilled.Checked = thisWorkEntry.is_billable == 0; ShowOnInv.Checked = thisWorkEntry.show_on_invoice == 1; if (isBilled.Checked) { ShowOnInv.Enabled = true; } } } else { Response.Write("<script>alert('工时已被删除!')window.close();</script>"); Response.End(); } } #region 根据批次获取相关工时 //var batchId = Request.QueryString["batchId"]; //if (!string.IsNullOrEmpty(batchId)) //{ // entryList = new sdk_work_entry_dal().GetBatchList(long.Parse(batchId)); // if(entryList!=null&& entryList.Count > 0) // { // thisWorkEntry = entryList[0]; // if (thisWorkEntry.approve_and_post_date != null || thisWorkEntry.approve_and_post_user_id != null) // { // Response.Write("<script>alert('审批提交的工时不可以更改!');window.close();</script>"); // Response.End(); // } // if (!resList.Any(_ => _.val == thisWorkEntry.create_user_id.ToString())) // { // Response.Write("<script>alert('系统设置不能代理操作!')window.close();</script>"); // Response.End(); // } // if (thisWorkEntry.end_time == null && noTimeSet != null && noTimeSet.setting_value == "0") // { // noTime = true; // } // entryList = new sdk_work_entry_dal().GetBatchList(thisWorkEntry.batch_id); // isAdd = false; // thisTask = new sdk_task_dal().FindNoDeleteById(thisWorkEntry.task_id); // if (!IsPostBack) // { // resource_id.SelectedValue = ((long)thisWorkEntry.resource_id).ToString(); // cost_code_id.SelectedValue = ((long)thisWorkEntry.cost_code_id).ToString(); // // status_id.SelectedValue = ((long)thisWorkEntry.) // // thisTask = new crm_account_dal().FindNoDeleteById(thisWorkEntry.); // } // if (thisWorkEntry.contract_id != null) // { // thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisWorkEntry.contract_id); // } // if (!IsPostBack) // { // isBilled.Checked = thisWorkEntry.is_billable == 0; // ShowOnInv.Checked = thisWorkEntry.show_on_invoice == 1; // if (isBilled.Checked) // { // ShowOnInv.Enabled = true; // } // } // } //} #endregion if (thisTask != null) { v_task = new v_task_all_dal().FindById(thisTask.id); thisProjetc = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id); if (thisProjetc != null) { thisAccount = new crm_account_dal().FindNoDeleteById(thisProjetc.account_id); if (!IsPostBack) { status_id.SelectedValue = thisTask.status_id.ToString(); } } } // 项目关联合同,并且合同中设置-工时录入需要输入开始结束时间 if (thisProjetc != null && thisProjetc.contract_id != null) { var thisCttContract = new ctt_contract_dal().FindNoDeleteById((long)thisProjetc.contract_id); if (thisCttContract != null) { if (thisCttContract.timeentry_need_begin_end == 1) { noTime = false; } } } if (thisCall != null) { showStartDate = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.start_time); showEndDate = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.end_time); } if (!string.IsNullOrEmpty(Request.QueryString["chooseDate"])) { showStartDate = DateTime.Parse(Request.QueryString["chooseDate"]); showEndDate = DateTime.Parse(Request.QueryString["chooseDate"]); } } catch (Exception msg) { Response.Write($"<script>alert('{msg.Message}');window.close();</script>"); } }
protected void Page_Load(object sender, EventArgs e) { long batchId; if (long.TryParse(Request.QueryString["id"], out batchId)) { isAdd = false; } if (!string.IsNullOrEmpty(Request.QueryString["resourceId"])) { resourceId = long.Parse(Request.QueryString["resourceId"]); } else { resourceId = LoginUserId; } var entryProxySet = new SysSettingBLL().GetValueById(SysSettingEnum.SDK_ENTRY_PROXY); if (entryProxySet == ((int)DicEnum.PROXY_TIME_ENTRY.ENABLED_TIMESHEET_APPROVERS).ToString()) { showResource = true; } if (string.IsNullOrEmpty(Request.QueryString["startDate"])) { startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); } else { startDate = DateTime.Parse(Request.QueryString["startDate"]); } if (!isAdd) // 编辑工时的开始日期 { workEntryList = bll.GetWorkEntryByBatchId(batchId); if (workEntryList.Count <= 0) { Response.Write("<script>alert('工时不存在');window.close();</script>"); Response.End(); return; } startDate = Tools.Date.DateHelper.TimeStampToUniversalDateTime(workEntryList[0].start_time.Value); resourceId = workEntryList[0].resource_id.Value; } if (startDate.DayOfWeek != DayOfWeek.Monday) { if (startDate.DayOfWeek == DayOfWeek.Sunday) { startDate = startDate.AddDays(-6); } else { startDate = startDate.AddDays((int)DayOfWeek.Monday - (int)startDate.DayOfWeek); } } resourceName = new UserResourceBLL().GetResourceById(resourceId).name; var costCodeList = bll.GetTimeCostCodeList(); if (!IsPostBack) { if (isAdd) { costCodeName.Visible = false; cost_code_id.DataValueField = "id"; cost_code_id.DataTextField = "name"; cost_code_id.DataSource = costCodeList; cost_code_id.DataBind(); } else { cost_code_id.Visible = false; costCodeName.Visible = true; costCodeName.Text = costCodeList.Find(_ => _.id == workEntryList[0].task_id).name; DateTime dt = new DateTime(startDate.Ticks); var find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { monday.Text = find.hours_billed.Value.ToString(); mondayInter.Value = find.internal_notes; mondayNodes.Value = find.summary_notes; } dt = dt.AddDays(1); find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { tuesday.Text = find.hours_billed.Value.ToString(); tuesdayInter.Value = find.internal_notes; tuesdayNodes.Value = find.summary_notes; } dt = dt.AddDays(1); find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { wednesday.Text = find.hours_billed.Value.ToString(); wednesdayInter.Value = find.internal_notes; wednesdayNodes.Value = find.summary_notes; } dt = dt.AddDays(1); find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { thursday.Text = find.hours_billed.Value.ToString(); thursdayInter.Value = find.internal_notes; thursdayNodes.Value = find.summary_notes; } dt = dt.AddDays(1); find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { friday.Text = find.hours_billed.Value.ToString(); fridayInter.Value = find.internal_notes; fridayNodes.Value = find.summary_notes; } dt = dt.AddDays(1); find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { saturday.Text = find.hours_billed.Value.ToString(); saturdayInter.Value = find.internal_notes; saturdayNodes.Value = find.summary_notes; } dt = dt.AddDays(1); find = workEntryList.Find(_ => _.start_time == Tools.Date.DateHelper.ToUniversalTimeStamp(dt)); if (find != null) { sunday.Text = find.hours_billed.Value.ToString(); sundayInter.Value = find.internal_notes; sundayNodes.Value = find.summary_notes; } } if (showResource) { var resList = new UserResourceBLL().GetResourceList(); resource_id.DataValueField = "val"; resource_id.DataTextField = "show"; resource_id.DataSource = resList; resource_id.DataBind(); if (resList.Exists(_ => _.val == resourceId.ToString())) { resource_id.SelectedValue = resourceId.ToString(); } } notify_tmpl_id.DataTextField = "name"; notify_tmpl_id.DataValueField = "id"; notify_tmpl_id.DataSource = new DAL.sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.TICKET_TIME_ENTRY_CREATED_EDITED); notify_tmpl_id.DataBind(); } else { List <string> weNames = new List <string> { "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday" }; if (isAdd && showResource) { resourceId = long.Parse(resource_id.SelectedValue); } var weList = new List <sdk_work_entry>(); for (int i = 0; i < weNames.Count; i++) { decimal hours_worked; if (!decimal.TryParse(Request.Form[weNames[i]], out hours_worked)) { continue; } sdk_work_entry we = new sdk_work_entry(); if (isAdd) { long taskId = long.Parse(cost_code_id.SelectedValue); we.task_id = taskId; we.cost_code_id = taskId; } else { we.batch_id = batchId; } we.resource_id = resourceId; we.start_time = Tools.Date.DateHelper.ToUniversalTimeStamp(startDate.AddDays(i)); we.end_time = we.start_time; we.hours_worked = hours_worked; we.hours_billed = hours_worked; we.offset_hours = 0; we.internal_notes = Request.Form[weNames[i] + "Inter"]; we.summary_notes = Request.Form[weNames[i] + "Nodes"]; we.is_billable = 0; we.show_on_invoice = 0; weList.Add(we); } if (isAdd) { bll.AddWorkEntry(weList, LoginUserId); } else if (!bll.EditWorkEntry(weList, batchId, LoginUserId)) { Response.Write("<script>alert('工时审批提交后不能编辑');</script>"); return; } if (Request.Form["subAct"] == "SaveClose") { Response.Write("<script>window.close();self.opener.location.reload();</script>"); Response.End(); } else { Response.Write("<script>window.location.href='RegularTimeAddEdit';self.opener.location.reload();</script>"); Response.End(); } } }
static void Main(string[] args) { //测试函数-数据字典bll set.Del(id) //SysSettingBLL set = new SysSettingBLL(); //sys_dict SysDict = new sys_dict(); //SysDict.category_name=""; //SysDict.dict_name =""; //Console.WriteLine(set.Add(SysDict)); //测试set.Update(SysDict) //SysSettingBLL set = new SysSettingBLL(); //sys_dict SysDict = new sys_dict(); //SysDict.category_name = ""; //SysDict.dict_name = ""; //SysDict.id = 11; //Console.WriteLine(set.Update(SysDict)); //测试set.Del(id) SysSettingBLL set = new SysSettingBLL(); List <int> list = new List <int>(); list.Add(37); list.Add(48); Result res = new Result(); res = set.DelAll(list); Console.WriteLine(res.Message); //测试 //SysSettingBLL set = new SysSettingBLL(); //Console.WriteLine(set.SeleteAll()); //List<sys_dict> listuser = set.SeleteAll(); //foreach (sys_dict a in listuser) //{ // Console.WriteLine(a.category_name + " " +a.dict_name + " " +a.create_time + " " + a.modify_time); //} //测试函数:login.Login(user) 测试成功BLL //LoginBLL login = new LoginBLL(); //string userName = "******"; //string password = "******"; //Console.WriteLine(login.Login(userName, password)); //测试函数:perm.Add(group) 测试成功BLL //PermBLL perm = new PermBLL(); //sys_group group = new sys_group(); //group.group_name = "员工"; //group.remark = "民警"; //Console.WriteLine(perm.Add(group)); //测试函数:perm.Addu2g(groupId,userId) 测试成功BLL //PermBLL perm = new PermBLL(); //int groupId = 26; //int userId = 32; //Console.WriteLine(perm.AddU2g(groupId, userId)); //测试函数:perm.Update(group) 测试成功BLL //PermBLL perm = new PermBLL(); //sys_group group = new sys_group(); //group.id = 26; //group.group_name = "普通用户"; //group.remark = "实习民警"; //Console.WriteLine(perm.Update(group)); //测试函数:perm.Del(groupId) 测试成功BLL //PermBLL perm = new PermBLL(); //int groupId = 19; //Console.WriteLine(perm.Del(groupId)); //测试函数:perm.perm(groupId) 测试成功BLL //PermBLL perm = new PermBLL(); //int groupId = 26; //int[] menu_id = { 4, 5, 6 }; //List<int> menuId = new List<int>(menu_id); //Console.WriteLine(perm.Perm(groupId, menuId)); //测试函数:perm.DelG2u(groupId) 测试成功BLL //PermBLL perm = new PermBLL(); //int groupId = 23; //int userId = 32; //Console.WriteLine(perm.DelG2u(groupId, userId)); //测试函数:perm.Selectu2g() 测试成功 //PermBLL perm = new PermBLL(); //int groupId = 15; //Console.WriteLine(perm.SelectU2g(groupId)); //测试函数:perm.Selectg2m() 测试成功 //PermBLL perm = new PermBLL(); //int groupId = 15; //Console.WriteLine(perm.SelectG2m(groupId)); //测试函数:perm.SelectGroup() 测试成功 //PermDAL perm = new PermDAL(); //sys_group group = new sys_group(); //group.group_name = "管理员"; //DateTime a = new DateTime(2011, 1, 1, 0, 0, 0); //group.create_time = a; //group.modify_time = new DateTime(2022, 1, 1, 1, 1, 1); //Console.WriteLine(perm.SelectGroup(group)); //测试函数:SysUser.add(sys_user user, int groupid) 测试成功BLL //SysUserBLL userbll = new SysUserBLL(); //sys_user user = new sys_user(); //user.username = "******"; //user.name = "小明"; //user.password = "******"; //user.gender = "男"; //user.job = "领导"; //user.phone = "17396226172"; //user.email = "*****@*****.**"; //user.status = false; //Console.WriteLine(userbll.add(user)); //测试函数:SysUser.Update(sys_user user,int groupid) 测试成功BLL //SysUserBLL userbll = new SysUserBLL(); //sys_user user = new sys_user(); //user.id = 27; //user.username = "******"; //user.name = "李华"; //user.password = "******"; //user.gender = "女"; //user.job = "领导"; //user.phone = "17396226172"; //user.email = "*****@*****.**"; //user.status = false; //Console.WriteLine(userbll.Update(user)); //测试函数:SysUser.Del(id) 测试成功BLL //SysUserBLL userbll = new SysUserBLL(); //int userId = 39; //Console.WriteLine(userbll.Del(userId)); //测试函数:Sysuser.Select(user, group) 测试成功BLL //SysUserBLL userbll = new SysUserBLL(); //sys_user user = new sys_user(); //user.name = "李华"; //Console.WriteLine(userbll.Select(user)); //数据字典测试开始 //测试函数:set.Add(dict) 测试成功 //SysSetting set = new SysSetting(); //sys_dict dict = new sys_dict(); //dict.dict_name = "费用类别"; //dict.category_name = "其他2"; //Console.WriteLine(set.Add(dict)); //测试函数:set.Update(dict) 测试成功 //SysSetting set = new SysSetting(); //sys_dict dict = new sys_dict(); //dict.category_name = "其他1"; //dict.dict_name = "费用类别"; //dict.id = 6; //Console.WriteLine(set.Update(dict)); //测试函数:set.Del(dict) 测试成功 //SysSetting set = new SysSetting(); //sys_dict dict = new sys_dict(); //dict.id = 6; //Console.WriteLine(set.Del(dict)); //测试函数:set.SelectAll() 测试成功 //SysSetting set = new SysSetting(); //Console.WriteLine(set.SelectAll()); //CostApplyDAL apply = new CostApplyDAL(); ///测试函数:costApply.Add(cost cost) ///返回类型:int ///测试结果:成功 //cost_main main = new cost_main //{ // apply_id=8, // remark="费用申请描述", // status=0, // apply_money = 951, // apply_time = DateTime.Now //}; //cost_detail detail = new cost_detail //{ // cost_type_name = "住宿", // cost_type = 4, // money = 451 //}; //cost_detail detail2 = new cost_detail //{ // cost_type_name = "餐饮", // cost_type = 5, // money = 160 //}; //cost_detail detail3 = new cost_detail //{ // cost_type_name = "出行", // cost_type = 8, // money = 340 //}; //List<cost_detail> listDetail = new List<cost_detail> //{ // detail, // detail2, // detail3 //}; //List<cost_approval> ListApproval = new List<cost_approval> //{ // new cost_approval // { // approval_id=29 // } //}; //Console.WriteLine(apply.Add(new cost { Main = main, DetailList = listDetail,ApprovalList=ListApproval })); ///测试函数:costApply.Update(cost cost) ///返回类型:int ///测试结果:成功 //cost_main main = new cost_main //{ // id = 1563613841, // apply_money = 900 //}; //cost_detail detail = new cost_detail //{ // cost_type_name = "其他", // cost_type=7, // money = 500 //}; //cost_detail detail2 = new cost_detail //{ // cost_type_name = "餐饮", // cost_type=5, // money = 400 //}; //List<cost_detail> listDetail = new List<cost_detail> //{ // detail, // detail2 //}; //Console.WriteLine(apply.Update(new cost { main=main,DetailList=listDetail})); ///测试函数:costApply.QueryMain(Dictionary<string, object> conditions) ///返回类型: ///测试结果:成功 ///参数中必需的属性: //Dictionary<string, object> conditions = new Dictionary<string, object> //{ // //{ "id", 1563517332 }, // //{ "applicant", "测试add" }, // //{ "status", 1 }, // //{ "start_time", new DateTime(2019, 7, 20,19,20,0) }, // //{ "end_time", new DateTime(2017, 5, 5) } // //{"page",2 }, // //{"limit",20 } //}; //List<cost_main> list = apply.QueryMain(conditions); //foreach (cost_main cm in list) //{ // Console.WriteLine(cm.id + " " + cm.applicant + " " + cm.approver + " " + cm.apply_time + " " + cm.approval_time + " " + cm.apply_money + " " + cm.approval_money + " " + cm.status + " " + cm.remark); //} // new CostApplyDAL().GetApprovalInfo(8); ///测试函数:costApproval.Update(cost_main main) ///返回类型:int ///测试结果:成功 ///参数中必需的属性: /// main:approver、approval_time、approval_money、status、id //cost_main main = new cost_main //{ // id = 1563517332, // approver = "小Abor", // approval_time = new DateTime(2019, 7, 18), // approval_money = 950, // status = 1 //}; //Console.WriteLine(new CostApproval().Update(main)); ///测试函数:costPlan.Add(List<cost_plan> listPlan) ///返回类型:int ///测试结果:成功 ///参数中必需的属性: /// plan:cost_type、money、start_time、end_time // CostPlan costplan = new CostPlan(); //cost_plan plan = new cost_plan(); //plan.cost_type = "出行"; //plan.money = 99; //plan.start_time = new DateTime(2011, 1, 1); //plan.end_time = new DateTime(2017, 1, 1); //cost_plan plan2 = new cost_plan(); //plan2.cost_type = "餐饮"; //plan2.money = 222; //plan2.start_time = new DateTime(2013, 1, 1); //plan2.end_time = new DateTime(2017, 1, 1); //List<cost_plan> ListPlan = new List<cost_plan>(); //ListPlan.Add(plan); //ListPlan.Add(plan2); //Console.WriteLine(costplan.Add(ListPlan)); ///测试函数:costPlan.Update(List<cost_plan> ListPlan) ///返回类型:int ///测试结果:成功 ///参数中必需的属性: /// plan:id、cost_type、money、start_time、end_time //CostPlan costPlan = new CostPlan(); //cost_plan plan = new cost_plan(); //plan.cost_type = "出行"; //plan.money = 999; //plan.start_time = new DateTime(2011, 1, 1); //plan.end_time = new DateTime(2017, 1, 1); //cost_plan plan2 = new cost_plan(); //plan2.cost_type = "餐饮"; //plan2.money = 999; //plan2.start_time = new DateTime(2011, 1, 1); //plan2.end_time = new DateTime(2017, 1, 1); //List<cost_plan> ListPlan = new List<cost_plan>(); //ListPlan.Add(plan); //ListPlan.Add(plan2); //Console.WriteLine(costPlan.Update(ListPlan)); ///测试函数:costPlan.Del(List<cost_plan> ListPlan ) ///返回类型:int ///测试结果:成功 ///参数中必需的属性: /// plan:start_time,end_time //CostPlan costplan = new CostPlan(); //cost_plan plan = new cost_plan(); //plan.start_time = (new DateTime(2011, 1, 1)); //plan.end_time = (new DateTime(2017, 1, 1)); //cost_plan plan2 = new cost_plan(); //plan2.start_time = (new DateTime(2011, 1, 9)); //plan2.end_time = (new DateTime(2017, 1, 1)); //List<cost_plan> ListPlan = new List<cost_plan>(); //ListPlan.Add(plan); //ListPlan.Add(plan2); //Console.WriteLine(costplan.Del(ListPlan)); ///测试函数:costPlan.Query() ///返回类型:List<cost_plan> ///测试结果:成功 ///参数中必需的属性: /// 无 //CostPlan costPlan = new CostPlan(); //List<cost_plan> listPlan = costPlan.Query(); //foreach (cost_plan plan in listPlan) //{ // Console.WriteLine(plan.id + " " + plan.cost_type + " " + plan.start_time + " " + plan.end_time + " " + plan.money); //} ///测试函数:costPlan.Query(Dictionary<string, object> conditions) ///返回类型:List<cost_plan> ///测试结果:成功 ///参数中必需的属性: /// conditions:条件键值对词典 key建议是"start_time", "end_time", "cost_type", "id"其中的,否则无效 //Dictionary<string, object> conditions = new Dictionary<string, object>(); //conditions.Add("cost_type","餐饮"); //List<cost_plan> listPlan = new CostPlan().Query(conditions); //foreach(cost_plan plan in listPlan) //{ //Console.WriteLine(plan.id+" "+plan.cost_type+" "+plan.start_time+" "+plan.end_time+" "+plan.money); //} ///测试函数:costPlan.QuerySum(DateTime SrartTime, DateTime EndTime) ///返回类型:decimal ///测试结果:成功 ///参数中必需的属性: /// plan:start_time,end_time,money //CostPlanDAL costPlan = new CostPlanDAL(); //Console.WriteLine(costPlan.QuerySum(new DateTime(2017,1,1),new DateTime (2017,2,1))); ///测试函数:CostStastic.Query(Dictionary<string, object> conditions) ///返回类型:Dictionary<cost_main, List<cost_detail>> ///测试结果:成功 ///参数中必需的属性: /// conditions:条件键值对词典 key建议是"start_time", "end_time", "apply_id"其中的,否则无效 //Dictionary<string, object> conditions = new Dictionary<string, object>(); //conditions.Add("apply_id", 27); //conditions.Add("start_time", new DateTime(2019, 7, 1)); //conditions.Add("end_time", new DateTime(2019, 8, 1)); //List<cost> ListCost = new CostStatisticDAL().Query(conditions); //foreach (cost C in ListCost) //{ // cost_main cm = C.main; // Console.WriteLine(cm.id + " " + cm.apply_id + " " + cm.approval_id + " " + cm.apply_time + " " + cm.approval_time + " " + cm.apply_money + " " + cm.approval_money + " " + cm.status + " " + cm.remark); // foreach (cost_detail cd in C.DetailList) // { // Console.WriteLine("\t" + cd.id + " " + cd.cost_id + " " + cd.cost_type + " "+cd.cost_type_name+" " + cd.money); // } //} ///添加文件 //PersonFileDAL files = new PersonFileDAL(); //person_file A = new person_file(); //A.id = 22; //A.person_id = 1; //A.filename = "张安的XXX"; //A.filetype = "222"; //A.create_time = new DateTime(2019, 4, 1); //A.modify_time = new DateTime(2018, 1, 18); //Console.WriteLine(files.Add(A)); ////更改文件名 //PersonFileDAL files = new PersonFileDAL(); //person_file A = new person_file(); //A.id = 28; //A.filename = "zhao"; //Console.WriteLine(files.Update(A)); ////删除文件 //PersonFileDAL files = new PersonFileDAL(); //person_file A = new person_file(); //A.id = 25; //Console.WriteLine(files.Del(A)); //根据ID查询文件 //PersonFileDAL files = new PersonFileDAL(); //List<person_file> Listfile = files.GetById(26); //foreach (person_file B in Listfile) //{ // Console.WriteLine(B.id + " " + B.person_id + " " + B.filename + " " + B.file + " " + B.filetype + " " + B.create_time + " " + B.modify_time); //} // 删除信息,测试 //根据id删除 //测试结果:成功 //LogSysDAL sys = new LogSysDAL(); //Console.WriteLine(sys.Del(4));//1成功,0失败 ////日志查询 测试 //查询所有 //测试结果:成功 //LogUserDAL user = new LogUserDAL(); //List<log_user> listuser = user.Query(18); //foreach (log_user loguser in listuser) //{ // Console.WriteLine(loguser.id + " " + loguser.user_id + " " + loguser.username + " " + loguser.operation + " " + loguser.ip + " " + loguser.create_time); //} //////系统日志查询,所有 //LogSysDAL sys = new LogSysDAL(); //List<log_sys> listsys = sys.Query(); //foreach (log_sys logsys in listsys) //{ // Console.WriteLine(logsys.id + " " + logsys.log_message + " " + logsys.create_time); //} //////日志查询 测试 ////根据用户名查询 ////测试结果:成功 //LogUser user = new LogUser(); //List<log_user> listuser = user.GetByUserName("1"); //foreach (log_user loguser in listuser) //{ // Console.WriteLine(loguser.id + " " + loguser.user_id + " " + loguser.username + " " + loguser.operation + " " + loguser.ip + " " + loguser.create_time); //} //日志条件查询 //用户名,时间段查询 //测试结果: //Dictionary<string, object> conditions = new Dictionary<string, object>(); //conditions.Add("username", "2"); ////conditions.Add("create_time", new DateTime(2019, 7, 18)); //List<log_user> user = new LogUserDAL().GetByConditionns(conditions); //foreach (log_user loguser in user) //{ // Console.WriteLine(loguser.id + " " + loguser.user_id + " " + loguser.username + " " + loguser.operation + " " + loguser.ip + " " + loguser.create_time); //} ////日志条件查询 ////用户名,时间段查询 ////测试结果: //LogUserDAL lu = new LogUserDAL(); //List<log_user> user = lu.Query("2",new DateTime(2019,7,18)); //foreach (log_user loguser in user) //{ // Console.WriteLine(loguser.id + " " + loguser.user_id + " " + loguser.username + " " + loguser.operation + " " + loguser.ip + " " + loguser.create_time); //} //} //LogSysDAL sys = new LogSysDAL(); // List<log_sys> sysList =sys.Query(new DateTime(2019,7,18)); // foreach (log_sys logsys in sysList) // { // Console.WriteLine(logsys.id + " " + logsys.create_time + " " + logsys.log_message); // } //PersonBasicDAL PB = new PersonBasicDAL(); //person_basic pb = new person_basic(); //pb.name = "赵四"; //pb.former_name = "尼古拉斯"; //pb.gender = "男"; //pb.identity_number = "123456789"; //pb.birth_date = DateTime.Now; //pb.native_place = "四川成都"; //pb.marry_status = true; //pb.job_status = "养猪"; //pb.income = 2000; //pb.temper = "未知"; //pb.family = "未知"; //pb.person_type_id = 1; //pb.qq = "123456789"; //pb.address = "成都市双流区养猪场"; //pb.phone = "123456789"; //pb.belong_place_id = 1; //pb.nation = "汉"; //pb.input_time = DateTime.Now; //pb.user_id = 81; //pb.isdel = 0; //插入 //if (PB.Add(pb) > 0) //{ // Console.WriteLine("插入成功!"); //} //else //{ // Console.WriteLine("插入失败!"); //} // 修改 //pb.id = 1001; //if (PB.Update(pb) > 0) //{ // Console.WriteLine("修改成功!"); //} //else //{ // Console.WriteLine("修改失败!"); //} // 移除 //int id = 1013; //if (PB.Remove(id) > 0) //{ // Console.WriteLine("移除成功!"); //} //else //{ // Console.WriteLine("移除失败!"); //} // 删除 //int id = 1020; //if (PB.Del(id) > 0) //{ // Console.WriteLine("删除成功!"); //} //else //{ // Console.WriteLine("删除失败!"); //} //List<person_basic> list = new List<person_basic>(); //pb.name = "赵四"; //pb.identity_number = "123456789"; //pb.person_type_name = "未知"; //pb.native_place = "四川成都"; // 查询 //list = PB.Query(pb); //list = PB.Query(); //for (int i = 0; i < list.Count; i++) //{ // Console.WriteLine(list[i].id + "\t" + list[i].name + "\t" + list[i].former_name + "\t" + list[i].gender + "\t" + list[i].identity_number + "\t" // + list[i].birth_date + "\t" + list[i].native_place + "\t" + list[i].marry_status + "\t" + list[i].job_status + "\t" // + list[i].income + "\t" + list[i].temper + "\t" + list[i].family + "\t" + list[i].person_type_id + "\t" + list[i].qq + "\t" // + list[i].address + "\t" + list[i].phone + "\t" + list[i].belong_place_id + "\t" + list[i].nation + "\t" + list[i].input_time + "\t" // + list[i].user_id + "\t" + list[i].isdel + "\t\n"); //} //Console.WriteLine("END..."); ///PersonFileBLL测试 /// ///修改文件名 /// ///测试结果: /// //PersonFileDAL personFile = new PersonFileDAL(); //person_file A = new person_file(); //List<person_file> ListFile = new List<person_file>(); //ListFile.Add(A); //Console.WriteLine(personFile.Update("123",28)); ///PersonFileBLL测试 /// ///通过personId查询文件 /// ///测试结果: /// //PersonFileDAL personFileDAL = new PersonFileDAL(); //List<person_file> listFile = personFileDAL.GetByPersonId(1001); //foreach (person_file A in listFile) //{ // Console.WriteLine(A.person_id + " " + A.id + " " + A.filename + " " + A.filetype + " " + A.create_time + " " + A.modify_time); //} Console.ReadKey(); }