| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data;
- using CoreFS.CA06;
- namespace Core.StlMes.Client.Sale.SaleFundMgt.FundDAL.BaseDAL
- {
- public class BaseDAL
- {
- private Core.StlMes.Client.Sale.DbHelp.DbExecute dbhelp = null;
- private string daoName = FundVariable.FundConstVariable.DefaultDaoName;
- public string ConvertStringDateValueToDbLanguage(string columnName, string beginDate, string endDate)
- {
- string strbegin = beginDate.Replace("-", "").Replace("/", "").Replace(" ","").Substring(0,8);
- string strend = endDate.Replace("-", "").Replace("/", "").Replace(" ", "").Substring(0,8);
- return string.Format(" and {0} >= trunc( to_date('{1}','yyyymmdd')) and {0} < trunc( to_date('{2}','yyyymmdd')) + 1 ",
- columnName, strbegin, strend);
- }
- public string DaoName
- {
- set
- {
- this.daoName = value;
- }
- }
- public BaseDAL(OpeBase ob)
- {
- // ob.MainUrl = FundVariable.FundConstVariable.defaultMainStringUrl;
- dbhelp = new Core.StlMes.Client.Sale.DbHelp.DbExecute(ob);
- }
-
- public System.Data.DataSet ExecuteReader(string sqlStr)
- {
- DataSet ds = new DataSet();
- try
- {
- ds = dbhelp.ExecuteQuery(sqlStr, daoName);
- }
- catch
- {
-
- }
- return ds;
- }
- protected void ExecuteNoReader(string sqlStr,out string errMsg)
- {
- errMsg = "";
- try
- {
- dbhelp.ExecuteNoQuery(sqlStr, daoName, out errMsg);
- }
- catch
- {
- }
- }
- protected void ExecuteNoReader(string sqlStr)
- {
-
- try
- {
- dbhelp.ExecuteNoQuery(sqlStr, daoName);
- }
- catch
- {
- }
- }
- protected void ExecuteNoReader(string sqlStr, Core.StlMes.Client.Sale.DbHelp.DbTransaction transaction)
- {
- try
- {
- dbhelp.ExecuteNoQueryTransaction(sqlStr, transaction);
- }
- catch
- {
- }
- }
- protected void ExecuteNoQueryTransaction(string sqlStr, Core.StlMes.Client.Sale.DbHelp.DbTransaction transaction)
- {
- try
- {
- dbhelp.ExecuteNoQueryTransaction(sqlStr, transaction);
- }
- catch
- {
- }
- }
- protected void ExecuteNoReaderForSaleFund(string sqlStr, Core.StlMes.Client.Sale.DbHelp.DbTransaction transaction)
- {
- ExecuteNoReader(sqlStr,transaction);
- }
- protected void ExecuteNoReaderForSaleFund(string sqlStr)
- {
- ExecuteNoReader(sqlStr);
- }
- protected void ExecuteNoReaderForSaleFund(string sqlStr,out string errMsg)
- {
- errMsg = "";
- ExecuteNoReader(sqlStr,out errMsg);
- }
- protected DataSet ExecuteReaderForSaleFund(string sqlstr)
- {
- return this.ExecuteReader(sqlstr);
- }
-
-
- protected virtual string GetSqlConditon(string balancesubject, string buyercode, string secondaccount, string pactno)
- {
- string sqlCondition = string.Format(" and balancesubject = '{0}' and buyercode = '{1}' and secondaccount = '{2}' and pactno = '{3}' ",
- balancesubject, buyercode, secondaccount, pactno
- );
- return sqlCondition;
- }
- protected virtual string GetSqlConditon(string balancesubject, string buyercode, string secondaccount)
- {
- string sqlCondition = string.Format(" and balancesubject = '{0}' and buyercode = '{1}' and secondaccount = '{2}' ",
- balancesubject, buyercode, secondaccount);
- return sqlCondition;
- }
-
- protected virtual string GetSqlConditon(string balancesubject, string pactno)
- {
- string sqlCondition = string.Format(" and balancesubject = '{0}' and pactno = '{1}' ",
- balancesubject, pactno);
- return sqlCondition;
- }
- protected virtual string GetSqlConditon(string balancesubject, string buyercode,string pactno,string v1,string v2,string v3)
- {
- string sqlCondition = string.Format(" and balancesubject = '{0}' and buyercode = '{2}' and pactno = '{1}' ",
- balancesubject, pactno,buyercode);
- return sqlCondition;
- }
-
- protected virtual string GetSqlConditon(string balancesubject, string buyercode, double v)
- {
- string sqlCondition = string.Format(" and balancesubject = '{0}' and buyercode = '{1}' ",
- balancesubject, buyercode);
- return sqlCondition;
- }
- /// <summary>
- /// 获取表中所有字段名称以及显示名称,组合成hs返回
- /// 允许前端重写
- /// 后续新增字段,注意结果按第一字母顺序
- /// 字段名统一大写
- /// </summary>
- /// <returns>Hashtable</returns>
- protected virtual System.Collections.Hashtable GetColumnNameAndCaption()
- {
- System.Collections.Hashtable hs = new System.Collections.Hashtable();
- try
- {
- hs.Add("ASKPLAN_ID", "提单号");
- hs.Add("ASKPLAN_MONEY", "货物款");
- hs.Add("BALANCESUBJECT", "销售组织");
- hs.Add("BILLNO", "票号");
- hs.Add("BUSISEQ", "序列");
- hs.Add("BUSITYPE", "类型");
- hs.Add("BUYERCODE", "客户单位");
- hs.Add("DELETEOR", "删除人");
- hs.Add("DELETETIME", "删除时间");
- hs.Add("FUNDTYPE", "类型");
- hs.Add("IMPORTOR", "录入人");
- hs.Add("IMPORTTIME", "录入时间");
- hs.Add("INOUTMONEY", "金额");
- hs.Add("INOUTTIME", "进出时间");
- hs.Add("INVOICE_MONEY", "金额");
- hs.Add("ISINVOINCE", "结算标志");
- hs.Add("ISMONEYVALID", "是否有效");
- hs.Add("ISUNUSUAL", "是否正常");
- hs.Add("ISVALID", "是否有效");
- hs.Add("LASTUPDATETIME", "更新时间");
- hs.Add("LEAVEMONEY", "剩余资金");
- hs.Add("MONEY", "发生金额");
- hs.Add("MONEY_TYPE", "类型");
- hs.Add("OTHERACCOUNT", "对方账户");
- hs.Add("PACTNO", "合同号");
- hs.Add("PACTNO_MONEY", "合同金额");
- hs.Add("PACT_BEGINDATE", "合同开始时间");
- hs.Add("PACT_REA_NAME", "映射名称");
- hs.Add("PACT_REA_NAME_SHOW", "映射名称");
- hs.Add("PRIORITY", "优先级");
- hs.Add("RELATION", "映射分类");
- hs.Add("REMARK", "备注");
- hs.Add("SECONDACCOUNT", "二级账户");
- hs.Add("TOTALMONEY", "总资金");
- hs.Add("TRANS_MONEY", "运费");
- hs.Add("TRANS_PERSON", "调拨人");
- hs.Add("TRANS_SEQ", "序列");
- hs.Add("TRANS_TIME", "时间");
- hs.Add("TRANS_TYPE", "类型");
- hs.Add("TYPE", "类型");
- hs.Add("USERID", "用户ID");
- hs.Add("UPDATETIME", "更新时间");
- hs.Add("WEIGHT", "重量");
-
-
- }
- catch
- {
-
- }
- return hs;
- }
- /// <summary>
- /// 设置数据集的标题
- /// </summary>
- /// <param name="ds"></param>
- /// <param name="hsColumn"></param>
- protected void SetDataSetCaption(ref DataSet ds, System.Collections.Hashtable hsColumn)
- {
- if (ds == null)
- return;
- if (ds.Tables.Count == 0)
- return;
- if (hsColumn == null)
- return;
- if (hsColumn.Count == 0)
- return;
- foreach ( DataColumn dc in ds.Tables[0].Columns)
- {
- try
- {
- dc.Caption = hsColumn[dc.ColumnName.ToUpper()].ToString();
- }
- catch
- {
- }
- }
- }
- }
- }
|