/// <summary> /// 获取总行数 /// </summary> /// <param name="company">公司名</param> /// <returns>总条数</returns> public int getCount(FinancePage <Profit> financePage, string company) { var companyParam = new SqlParameter("@company", company); var directionsParam = new SqlParameter("@direction", financePage.selectParamsMap["direction"]); var start_date = new SqlParameter("@start_date", financePage.selectParamsMap["start_date"]); var stop_date = new SqlParameter("@stop_date", financePage.selectParamsMap["stop_date"]); string sql = "select name,y.sum_month,y.sum_year from Accounting as a,(SELECT code,isnull((SELECT sum(money) FROM VoucherSummary WHERE voucherDate >= CONVERT(date,@start_date) and voucherDate <= CONVERT(date,@stop_date) AND code = y.code),0) AS sum_month,isnull((SELECT sum(money) FROM VoucherSummary WHERE YEAR(voucherDate) = year(CONVERT(date,@start_date)) AND code = y.code),0) AS sum_year FROM VoucherSummary AS y WHERE company = @company and YEAR(voucherDate) = year(CONVERT(date,@start_date)) GROUP BY y.code) as y where a.code = y.code and a.company = @company and a.direction = @direction"; var result = fin.Database.SqlQuery <Liabilities>(sql, companyParam, directionsParam, start_date, stop_date); int count = 0; try { count = result.ToList().Count; } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(count); }
/// <summary> /// 获取集合 /// </summary> /// <param name="financePage">分页对象</param> /// <param name="company">公司名</param> /// <returns>有pegeList的分页对象</returns> public FinancePage <Profit> getProfitList(FinancePage <Profit> financePage, string company) { var companyParam = new SqlParameter("@company", company); var minPageParam = new SqlParameter("@minPage", financePage.getMin()); var maxPageParam = new SqlParameter("@maxPage", financePage.getMax()); var directionsParam = new SqlParameter("@direction", financePage.selectParamsMap["direction"]); var start_date = new SqlParameter("@start_date", financePage.selectParamsMap["start_date"]); var stop_date = new SqlParameter("@stop_date", financePage.selectParamsMap["stop_date"]); string sql = "select name,sum_month,sum_year from (select name,y.sum_month,y.sum_year,row_number() over(order by name) as rownum from Accounting as a,(SELECT code,isnull((SELECT sum(money) FROM VoucherSummary WHERE voucherDate >= CONVERT(date,@start_date) and voucherDate <= CONVERT(date,@stop_date) AND code = y.code),0) AS sum_month,isnull((SELECT sum(money) FROM VoucherSummary WHERE YEAR(voucherDate) = year(CONVERT(date,@start_date)) AND code = y.code),0) AS sum_year FROM VoucherSummary AS y WHERE company = @company and YEAR(voucherDate) = year(CONVERT(date,@start_date)) GROUP BY y.code) as y where a.code = y.code and a.company = @company and a.direction = @direction) as t where t.rownum > @minPage and t.rownum < @maxPage"; var result = fin.Database.SqlQuery <Profit>(sql, companyParam, minPageParam, maxPageParam, directionsParam, start_date, stop_date); try { financePage.pageList = result.ToList(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(financePage); }
//科目余额 public List <Charts> getAccountBalance(string company, string start_date, string stop_date) { if (start_date == "") { start_date = "1900-01-01"; } if (stop_date == "") { stop_date = "2100-12-31"; } var selectParam = new SqlParameter[] { new SqlParameter("@company", company), new SqlParameter("@start_date", start_date), new SqlParameter("@stop_date", stop_date), }; string sql = "SELECT sum(a.load) +ISNULL(sum(v.money), 0) as sum_load,sum(a.borrowed) as sum_borrowed from Accounting as a LEFT JOIN VoucherSummary as v on v.code = a.code where a.company = @company GROUP BY left(a.code,1)"; var result = fin.Database.SqlQuery <Charts>(sql, selectParam); List <Charts> list = null; try { list = result.ToList(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(list); }
public FinancePage <AccountingItem> getList2(FinancePage <AccountingItem> financePage, string company, int classId, string code) { //类别 var classParam = new SqlParameter("@class", classId); //公司 var companyParam = new SqlParameter("@company", company); //查询最小行号 var minPageParam = new SqlParameter("@minPageParam", financePage.getMin()); //查询最大行号 var maxPageParam = new SqlParameter("@maxPageParam", financePage.getMax()); var kemudaima = new SqlParameter("@code", code); string sql = "select (case len(code) when 4 then 'I' when 6 then 'II' when 8 then 'III' else '' end) as grade,*,isnull((SELECT SUM(money) FROM VoucherSummary WHERE VoucherSummary.code = a.code),0) as money,isnull((select top 1 name from Accounting as ac where ac.code = LEFT(a.code,4)),'') + isnull((select top 1 '-'+name from Accounting as ac where ac.code = LEFT(a.code,6) and ac.code != LEFT(a.code,4)),'') + isnull((select top 1 '-'+name from Accounting as ac where ac.code = LEFT(a.code,8) and ac.code != LEFT(a.code,6)),'') as fullName from (select *,ROW_NUMBER() over(order by LEN(code),id) as rownum from (select * from (SELECT *,LEFT(code, 1) AS class from Accounting) as t where t.class = @class and t.company = @company) as c )as a where a.rownum > @minPageParam and a.rownum < @maxPageParam"; if (code != "") { sql = sql + " and code like '%" + code + "%'"; } var result = fin.Database.SqlQuery <AccountingItem>(sql, classParam, companyParam, minPageParam, maxPageParam); try { financePage.pageList = result.ToList(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(financePage); }
/// <summary> /// 获取集合 /// </summary> /// <param name="financePage">分页对象</param> /// <param name="company">公司名</param> /// <returns>有pegeList的分页对象</returns> public FinancePage <Flow> getFlowList(FinancePage <Flow> financePage, string company) { var companyParam = new SqlParameter("@company", company); var minPageParam = new SqlParameter("@minPage", financePage.getMin()); var maxPageParam = new SqlParameter("@maxPage", financePage.getMax()); var start_date = new SqlParameter("@start_date", financePage.selectParamsMap["start_date"]); var stop_date = new SqlParameter("@stop_date", financePage.selectParamsMap["stop_date"]); //string sql = "select all_.expenditure,all_.money_month,all_.money_year from (select row_number() over(order by expenditure) as rownum,expenditure,isnull((select sum(s.money) from VoucherSummary as s where company = @company and year(voucherDate) = @year and month(voucherDate) = @month and s.expenditure = v.expenditure),0) as money_month,isnull((select sum(s.money) from VoucherSummary as s where company = @company and year(voucherDate) = @year and s.expenditure = v.expenditure),0) as money_year from VoucherSummary as v where company = @company GROUP BY expenditure) as all_ where all_.rownum > @minPage and all_.rownum < @maxPage"; string sql = "select all_.expenditure,all_.money_month,all_.money_year from (select row_number() over(order by expenditure) as rownum,expenditure,isnull((select sum(s.money) from VoucherSummary as s where company = @company and voucherDate >= CONVERT(date,@start_date) and voucherDate <= CONVERT(date,@stop_date) and s.expenditure = v.expenditure),0) as money_month,isnull((select sum(s.money) from VoucherSummary as s where company = @company and year(voucherDate) = year(CONVERT(date,@start_date)) and s.expenditure = v.expenditure),0) as money_year from VoucherSummary as v where company = @company GROUP BY expenditure) as all_ where all_.rownum > @minPage and all_.rownum < @maxPage"; var result = fin.Database.SqlQuery <Flow>(sql, companyParam, minPageParam, maxPageParam, start_date, stop_date); try { financePage.pageList = result.ToList(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(financePage); }
/// <summary> /// 获取集合 /// </summary> /// <param name="financePage">分页对象</param> /// <param name="company">公司名</param> /// <returns>有pegeList的分页对象</returns> public FinancePage <Liabilities> getLiabilitiesList(FinancePage <Liabilities> financePage, string company) { var companyParam = new SqlParameter("@company", company); var minPageParam = new SqlParameter("@minPage", financePage.getMin()); var maxPageParam = new SqlParameter("@maxPage", financePage.getMax()); var classParam = new SqlParameter("@class", financePage.selectParamsMap["classId"]); var start_date = new SqlParameter("@start_date", financePage.selectParamsMap["start_date"]); var stop_date = new SqlParameter("@stop_date", financePage.selectParamsMap["stop_date"]); //string sql = "select all_.name,all_.load,all_.borrowed,all_.money from (select row_number() over(order by a.name) as rownum,a.name,sum(a.load) as load,sum(a.borrowed) as borrowed,isnull(sum(v.money),0) as money from Accounting as a left join VoucherSummary as v on a.code = v.code and v.company = @company and year(v.voucherDate) = @year and month(v.voucherDate) = @month where a.company = @company and left(a.code,1) = @class group by a.name,left(a.code,1)) as all_ where all_.rownum > @minPage and all_.rownum < @maxPage"; string sql = "select name,[load],borrowed,CONVERT(Decimal,0) as money from (select row_number() over(order by a.name) as rownum, a.name,left(a.code,1) as class,v.company,(CASE @class WHEN 1 THEN sum(load-borrowed) ELSE sum(borrowed-load) END) as [load],(CASE @class WHEN 1 THEN sum([load]-borrowed+ISNULL(v.money, 0)) ELSE sum(borrowed-[load]+ISNULL(v.money, 0)) END) as borrowed from Accounting as a left join VoucherSummary as v on a.code = v.code WHERE left(a.code,1) = @class and a.company = @company and v.voucherDate >= convert(date,@start_date) and v.voucherDate <= convert(date,@stop_date) GROUP BY a.code,a.name,v.company) as a where (a.company = @company or a.company is null) and a.rownum > @minPage and a.rownum < @maxPage"; //string sql = "select all_.name,all_.load,all_.borrowed,all_.money from (select row_number() over(order by a.name) as rownum,a.name,sum(a.load) as load,sum(a.borrowed) as borrowed,isnull(sum(v.money),0) as money from Accounting as a left join VoucherSummary as v on a.code = v.code and v.company = @company and v.voucherDate >= CONVERT(date,@start_date) and v.voucherDate <= CONVERT(date,@stop_date) where a.company = @company and left(a.code,1) = 1 group by a.name,left(a.code,1)) as all_ where all_.rownum > @minPage and all_.rownum < @maxPage"; var result = fin.Database.SqlQuery <Liabilities>(sql, companyParam, minPageParam, maxPageParam, classParam, start_date, stop_date); try { financePage.pageList = result.ToList(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(financePage); }
/// <summary> /// 某一年经营结余 /// </summary> /// <param name="company">公司</param> /// <param name="date">日期</param> /// <returns></returns> public decimal getFinancingYear(string company, string start_date, string stop_date) { if (start_date == "") { start_date = DateTime.Now.ToString("yyyy-MM-dd"); } if (stop_date == "") { stop_date = DateTime.Now.ToString("yyyy-MM-dd"); } var selectParam = new SqlParameter[] { new SqlParameter("@company", company), new SqlParameter("@start_date", start_date), new SqlParameter("@stop_date", stop_date), }; string sql = "select ISNULL(sum(a.money_year), 0) as sum_year from (select expenditure,(select sum(s.money) from VoucherSummary as s where company = @company and year(voucherDate) >= year(@start_date) and year(voucherDate) <= year(@stop_date) and s.expenditure = v.expenditure) as money_year from VoucherSummary as v where company = @company GROUP BY expenditure) as a where a.expenditure in (select financingExpenditure from FinancingExpenditure) or a.expenditure in (select financingIncome from FinancingIncome)"; decimal financingYear = 0; var result = fin.Database.SqlQuery <Charts>(sql, selectParam); try { financingYear = result.ToList()[0].sum_year; } catch (Exception ex) { financingYear = 0; FinanceToError.getFinanceToError().toError(); } return(financingYear); }
public List <Accounting> getList(string company, int classId, int grade, int code) { //公司 var companyParam = new SqlParameter("@company", company); //公司 var classParam = new SqlParameter("@classId", classId); //公司 var gradeParam = new SqlParameter("@grade", grade); //公司 var parentCodeParam = new SqlParameter("@code", code); string codeSql = ""; if (code > 0) { codeSql = " and left(code," + (grade - 2) + ") = @code"; } string sql = "select * from Accounting where company = @company and left(code,1) = @classId and len(code) = @grade" + codeSql; var result = fin.Database.SqlQuery <Accounting>(sql, companyParam, classParam, gradeParam, parentCodeParam); List <Accounting> accountingList = null; try { accountingList = result.ToList(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(accountingList); }
//凭证金额 public List <Charts> getSummary(string company, string start_date, string stop_date) { if (start_date == "") { start_date = "1900-01-01"; } if (stop_date == "") { stop_date = "2100-12-31"; } var selectParam = new SqlParameter[] { new SqlParameter("@company", company), new SqlParameter("@start_date", start_date), new SqlParameter("@stop_date", stop_date), }; string sql = "select isnull(sum(v.money),0) as [sum],a.direction from VoucherSummary as v,Accounting as a where a.company = @company and v.company = @company and a.code = v.code and v.voucherDate >= @start_date and v.voucherDate <= @stop_date GROUP BY a.direction"; var result = fin.Database.SqlQuery <Charts>(sql, selectParam); List <Charts> list = null; try { list = result.ToList(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(list); }
/// <summary> /// 获取泛型类的集合 /// </summary> /// <typeparam name="T">泛型</typeparam> /// <param name="entity">泛型对象</param> /// <param name="financePage">分页对象</param> /// <param name="company">公司名</param> /// <param name="columnName">特殊字段处理</param> /// <returns>有pageList的分页对象</returns> public FinancePage <T> getComList <T>(T entity, FinancePage <T> financePage, string company, string columnName) { var companyParam = new SqlParameter("@company", company); var maxPageParam = new SqlParameter("@maxPage", financePage.getMax()); var minPageParam = new SqlParameter("@minPage", financePage.getMin()); string sqlString = fin.Set(entity.GetType()).ToString(); string sql = "select l.*,l." + columnName + " as " + columnName + "1 from (select ROW_NUMBER() over(order by id) as rownum,a.* from (" + sqlString + ") as a) as l where l.rownum > @minPage and l.rownum < @maxPage and l.company = @company"; var result = fin.Set(entity.GetType()).SqlQuery(sql, companyParam, maxPageParam, minPageParam); try { var selectList = result.GetEnumerator(); while (selectList.MoveNext()) { financePage.pageList.Add((T)selectList.Current); } } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(financePage); }
//利润合计 public List <Charts> getProfit(string company, string start_date, string stop_date) { if (start_date == "") { start_date = DateTime.Now.ToString("yyyy-MM-dd"); } if (stop_date == "") { stop_date = DateTime.Now.ToString("yyyy-MM-dd"); } var selectParam = new SqlParameter[] { new SqlParameter("@company", company), new SqlParameter("@start_date", start_date), new SqlParameter("@stop_date", stop_date), }; string sql = "SELECT isnull( SUM ( a.sum_month ), 0 ) AS sum_month,isnull( SUM ( a.sum_year ), 0 ) AS sum_year FROM(SELECT y.sum_month,y.sum_year,a.direction FROM Accounting AS a,(SELECT code,(SELECT SUM( money ) FROM VoucherSummary WHERE MONTH ( voucherDate ) >= MONTH ( @start_date ) AND MONTH ( voucherDate ) <= MONTH ( @stop_date ) AND code = y.code ) AS sum_month,(SELECT SUM( money ) FROM VoucherSummary WHERE YEAR ( voucherDate ) >= YEAR ( @start_date ) AND YEAR ( voucherDate ) <= YEAR ( @stop_date ) AND code = y.code ) AS sum_year FROM VoucherSummary AS y WHERE company = @company AND YEAR ( voucherDate ) >= YEAR ( @start_date ) AND YEAR ( voucherDate ) <= YEAR ( @stop_date ) GROUP BY y.code ) AS y WHERE a.code = y.code AND a.company = @company AND a.direction IN ( 0, 1)) AS a GROUP BY a.direction"; List <Charts> list = new List <Charts>(); var result = fin.Database.SqlQuery <Charts>(sql, selectParam); try { list = result.ToList(); } catch (Exception ex) { list = null; FinanceToError.getFinanceToError().toError(); } return(list); }
//资产负债 public List <Charts> getLiabilities(string company, string start_date, string stop_date) { if (start_date == "") { start_date = DateTime.Now.ToString("yyyy-MM-dd"); } var selectParam = new SqlParameter[] { new SqlParameter("@company", company), new SqlParameter("@start_date", start_date), }; string sql = "select isnull(sum(a.sum_load),0) as sum_load,isnull(sum(sum_borrowed),0) as sum_borrowed,isnull(sum(a.sum_money),0) as sum_money from (select v.company,sum(load) as sum_load,sum(borrowed) as sum_borrowed,sum(ISNULL(v.money, 0)) as sum_money,a.code from Accounting as a left join VoucherSummary as v on a.code = v.code WHERE a.company = @company and year(v.voucherDate) = year(@start_date) GROUP BY a.code,a.name,v.company) as a where a.company = @company or a.company is null group by left(a.code,1) HAVING left(a.code,1) in (1,2,3)"; List <Charts> list = new List <Charts>(); var result = fin.Database.SqlQuery <Charts>(sql, selectParam); try { list = result.ToList(); } catch (Exception ex) { list = null; FinanceToError.getFinanceToError().toError(); } return(list); }
public int updQuanXian(quanxian quanxian) { //新的实体类添加到上下文 quanxian updquanxian = null; List <quanxian> list = fin.quanxian.Where(u => u.bianhao == quanxian.bianhao).ToList(); int quanxianid = list[0].id; updquanxian = fin.quanxian.Find(quanxianid); updquanxian.kmzz_add = quanxian.kmzz_add; updquanxian.kmzz_delete = quanxian.kmzz_delete; updquanxian.kmzz_update = quanxian.kmzz_update; updquanxian.kmzz_select = quanxian.kmzz_select; updquanxian.kzxm_add = quanxian.kzxm_add; updquanxian.kzxm_delete = quanxian.kzxm_delete; updquanxian.kzxm_update = quanxian.kzxm_update; updquanxian.kzxm_select = quanxian.kzxm_select; updquanxian.bmsz_add = quanxian.bmsz_add; updquanxian.bmsz_delete = quanxian.bmsz_delete; updquanxian.bmsz_update = quanxian.bmsz_update; updquanxian.bmsz_select = quanxian.bmsz_select; updquanxian.zhgl_add = quanxian.zhgl_add; updquanxian.zhgl_delete = quanxian.zhgl_delete; updquanxian.zhgl_update = quanxian.zhgl_update; updquanxian.zhgl_select = quanxian.zhgl_select; updquanxian.pzhz_add = quanxian.pzhz_add; updquanxian.pzhz_delete = quanxian.pzhz_delete; updquanxian.pzhz_update = quanxian.pzhz_update; updquanxian.pzhz_select = quanxian.pzhz_select; updquanxian.znkb_select = quanxian.znkb_select; updquanxian.xjll_select = quanxian.xjll_select; updquanxian.zcfz_select = quanxian.zcfz_select; updquanxian.lysy_select = quanxian.lysy_select; updquanxian.jjtz_add = quanxian.jjtz_add; updquanxian.jjtz_delete = quanxian.jjtz_delete; updquanxian.jjtz_update = quanxian.jjtz_update; updquanxian.jjtz_select = quanxian.jjtz_select; updquanxian.jjzz_add = quanxian.jjzz_add; updquanxian.jjzz_delete = quanxian.jjzz_delete; updquanxian.jjzz_update = quanxian.jjzz_update; updquanxian.jjzz_select = quanxian.jjzz_select; fin.quanxian.Attach(updquanxian); //手动修改状态 fin.Entry <quanxian>(updquanxian).State = EntityState.Modified; int result = 0; try { //保存修改 result = fin.SaveChanges(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(result); }
/// <summary> /// 获取 /// </summary> /// <typeparam name="T">泛型</typeparam> /// <param name="entity">泛型类型对象</param> /// <param name="id">id</param> /// <returns></returns> public T comFind <T>(T entity, int id) { try { var result = fin.Set(entity.GetType()).Find(id); entity = (T)result; } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(entity); }
/// <summary> /// 获取部门对象 /// </summary> /// <param name="id">部门id</param> /// <returns>部门对象</returns> public Department findDepartment(int id) { Department deopartment = null; try { deopartment = fin.Department.Find(id); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(deopartment); }
public Account findUser(int id) { Account deopartment = null; try { deopartment = fin.Account.Find(id); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(deopartment); }
public Accounting getAccounting(int id) { Accounting accounting = null; try { accounting = fin.Accounting.Find(id); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(accounting); }
/// <summary> /// 新增部门 /// </summary> /// <param name="department">部门对象</param> /// <returns>影响行数</returns> public int newDepartment(Department department) { fin.Department.Add(department); int result = 0; try { result = fin.SaveChanges(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(result); }
public int newAccounting(Accounting accounting) { fin.Accounting.Add(accounting); int result = 0; try { result = fin.SaveChanges(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(result); }
/// <summary> /// 添加 /// </summary> /// <typeparam name="T">类型</typeparam> /// <param name="entity">泛型类型对象</param> /// <returns>影响行数</returns> public int comAdd <T>(T entity) { int result = 0; fin.Set(entity.GetType()).Add(entity); try { result = fin.SaveChanges(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(result); }
/// <summary> /// 获取用户集合 /// </summary> /// <returns>用户集合</returns> public List <Account> getAccounts() { var result = from u in fin.Account select u; List <Account> accountList = null; try { accountList = result.ToList(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(accountList); }
/// <summary> /// 获取单个用户对象 /// </summary> /// <param name="id">用户id</param> /// <returns>用户对象</returns> public Account getAccount(int id) { var result = from u in fin.Account where u.id == id select u; Account account = null; try { account = result.FirstOrDefault(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(account); }
/// <summary> /// 获取单个用户对象 /// </summary> /// <param name="name">用户名</param> /// <returns>用户对象</returns> public Account getAccount(string name) { Account account = null; var result = from u in fin.Account where u.name == name select u; try { account = result.FirstOrDefault(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(account); }
/// <summary> /// 获取单个用户对象 /// </summary> /// <param name="company">公司</param> /// <param name="name">姓名</param> /// <param name="pwd">密码</param> /// <returns>用户对象</returns>Web public Account getAccount(string company, string name, string pwd) { var result = from u in fin.Account where u.company == company && u.name == name && u.pwd == pwd select u; Account account = null; try { account = result.FirstOrDefault(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(account); }
/// <summary> /// 新增用户 /// </summary> /// <param name="account">新用户</param> /// <returns>影响行数</returns> public int newUser(Account account) { int result = 0; try { fin.Entry <Account>(account).State = EntityState.Added; result = fin.SaveChanges(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(result); }
/// <summary> /// 获取总行数 /// </summary> /// <param name="company">公司名</param> /// <returns>行数</returns> public int getCount(string company) { var result = from u in fin.VoucherSummary where u.company == company select u; int count = 0; try { count = result.ToList().Count; } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(count); }
/// <summary> /// 删除部门 /// </summary> /// <param name="id">部门id</param> /// <returns>影响行数</returns> public int delDepartment(int id) { fin.Department.Remove(this.findDepartment(id)); int result = 0; try { result = fin.SaveChanges(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(result); }
/// <summary> /// 获取时间配置表中的某个公司对象 /// </summary> /// <param name="company">公司名</param> /// <returns>control_soft_time</returns> public control_soft_time getUserSpaceInfo(string company) { var result = from u in bde.control_soft_time where u.name == company && u.soft_name == "财务" select u; control_soft_time cst = null; try { cst = result.FirstOrDefault(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(cst); }
public int newQuanXian(quanxian quan) { fin.quanxian.Add(quan); int result = 0; try { result = fin.SaveChanges(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(result); }
/// <summary> /// 获取集合 /// </summary> /// <param name="company">公司</param> /// <returns></returns> public List <SimpleAccounting> getList(string company) { var result = from u in fin.SimpleAccounting where u.company == company select u; List <SimpleAccounting> list = null; try { list = result.ToList(); } catch (Exception ex) { FinanceToError.getFinanceToError().toError(); } return(list); }