Ejemplo n.º 1
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string 序列号)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from tsuhan_scgl_fx");
            strSql.Append(" where 序列号=@序列号 ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@序列号", SqlDbType.NVarChar, 20)
            };
            parameters[0].Value = 序列号;

            return(dbhelper1.Exists(strSql.ToString(), parameters));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string 工号, string 密码)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from tsuhan_scgl_yh2");
            strSql.Append(" where 工号=@工号 and 密码=@密码");
            SqlParameter[] parameters =
            {
                new SqlParameter("@工号", SqlDbType.NVarChar, 20),
                new SqlParameter("@密码", SqlDbType.NVarChar, 20)
            };
            parameters[0].Value = 工号;
            parameters[1].Value = 密码;

            return(dbhelper3.Exists(strSql.ToString(), parameters));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 判断是否存在记录
        /// </summary>
        /// <param name="cpbm"></param>
        /// <returns></returns>
        public bool Exist(string 成品编码)
        {
            string sql = "SELECT * FROM tsuhan_gt_cpbm where 成品编码='" + 成品编码 + "'";

            SqlParameter[] parameters =
            {
                new SqlParameter("@成品编码", SqlDbType.NVarChar, 30)
            };
            parameters[0].Value = 成品编码;
            return(dbhelper1.Exists(sql, parameters));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 判断客户代码是否存在
        /// </summary>
        /// <param name="dm"></param>
        /// <returns></returns>
        public bool Exist(string 客户代码)
        {
            string sql = "SELECT * FROM tsuhan_scgl_khdm where 客户代码='" + 客户代码 + "'";

            SqlParameter[] parameters =
            {
                new SqlParameter("@客户代码", SqlDbType.VarChar, 30)
            };
            parameters[0].Value = 客户代码;
            return(dbhelper3.Exists(sql, parameters));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 判断是否存在该记录
        /// </summary>
        /// <param name="备货单号"></param>
        /// <returns></returns>
        public bool Exists(string 备货单号)
        {
            string sql = "select * from tsuhan_sg_bhd where 备货单号='" + 备货单号 + "'";

            SqlParameter[] parameters =
            {
                new SqlParameter("@备货单号", SqlDbType.NVarChar, 30)
            };
            parameters[0].Value = 备货单号;
            return(dbhelper1.Exists(sql, parameters));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 根据备货单号查询信息
        /// </summary>
        /// <param name="备货单号"></param>
        /// <returns></returns>
        public bool Exists(string 备货单号)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from tsuhan_sg_gt");
            strSql.Append(" where 备货单号=@备货单号 ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@备货单号", SqlDbType.NVarChar, 30)
            };
            parameters[0].Value = 备货单号;
            return(dbhelper.Exists(strSql.ToString(), parameters));
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 工单是否存在
 /// </summary>
 /// <param name="OrderID"></param>
 /// <returns></returns>
 public bool Exists(string OrderID)
 {
     if (OrderID.Length > 10)
     {
         string        _orderTyep = OrderID.Substring(0, 3);
         string        _orderid   = OrderID.Substring(4, OrderID.Length - 4);
         StringBuilder strSql     = new StringBuilder();
         strSql.Append("select count(1) from MOCTA");
         strSql.Append(" where TA001='" + _orderTyep + "' and TA002='" + _orderid + "'");
         return(ligMat.Exists(strSql.ToString()));
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 根据备货单和出货日期查询是否有数据
        /// </summary>
        /// <param name="备货单号"></param>
        /// <param name="入库时间"></param>
        /// <returns></returns>
        public bool Exist(string 备货单号, DateTime 入库时间)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) from tsuhan_rkselect");
            strSql.Append(" where 备货单号=@备货单号 and 入库时间=@入库时间");
            SqlParameter[] parameters =
            {
                new SqlParameter("@备货单号", SqlDbType.NVarChar, 20),
                new SqlParameter("@入库时间", SqlDbType.DateTime, 8)
            };
            parameters[0].Value = 备货单号;
            parameters[1].Value = 入库时间;

            return(dbhelper1.Exists(strSql.ToString(), parameters));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 测试U8登录
        ///  source = "(default)"
        /// </summary>
        /// <returns></returns>
        public static int TestU8Login(string sqlconnection, string ServerName, string source, string accid, string userid, string pwd,
                                      string yearid, string date,
                                      out string errmsg)
        {
            Model.DealResult dr = new Model.DealResult();

            U8Login.clsLogin u8Login = new U8Login.clsLogin();

            #region 判断格式  登录

            string strErr = ",请在[账套档案注册]模块中更新!";
            if (string.IsNullOrEmpty(userid))
            {
                dr.ResultMsg = "默认操作员不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(source))
            {
                dr.ResultMsg = "数据源不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(accid))
            {
                dr.ResultMsg = "账套号不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(ServerName))
            {
                dr.ResultMsg = "服务器地址不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(yearid))
            {
                dr.ResultMsg = "登陆年度不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            else
            {
                try { int.Parse(yearid); }
                catch
                {
                    dr.ResultMsg = "登陆年度格式错误:" + yearid + strErr;
                    dr.ResultNum = -1;
                    Marshal.FinalReleaseComObject(u8Login);
                    throw new Exception(dr.ResultMsg);
                }
            }

            if (!string.IsNullOrEmpty(sqlconnection))
            {
                DbHelperSQLP dsp    = new DbHelperSQLP(sqlconnection);
                string       strSql = "SELECT 1 FROM UFSystem.dbo.UA_AccountDatabase A JOIN UFSystem.dbo.UA_Account B ON A.cAcc_Id=B.cAcc_Id WHERE A.cAcc_Id='" + accid + "' ";
                if (!dsp.Exists(strSql))
                {
                    dr.ResultMsg = "登陆失败,原因:账套 " + accid + " 在 " + ServerName + " 上不存在";
                    dr.ResultNum = -1;
                    Marshal.FinalReleaseComObject(u8Login);
                    errmsg = dr.ResultMsg;
                    return(-1);
                }
            }
            #endregion

            string subId  = U8.Interface.Bus.SysInfo.subId;
            string userId = userid;
            string accId  = source + "@" + accid;

            string yearId   = yearid; // DateTime.Now.ToString("yyyy"); // yearid;
            string password = pwd;
            string _date    = date;   // DateTime.Now.ToString("yyyy-MM-dd");  //bd.ConnectInfo.Date;
            string srv      = ServerName;
            string serial   = BLL.Common.GetSerial();


            #region 20140814

            #endregion

            if (!u8Login.Login(ref subId, ref accId, ref yearId, ref userId, ref password, ref _date, ref srv, ref serial))
            {
                dr.ResultMsg = "登陆失败,原因:" + u8Login.ShareString;
                if (u8Login.ShareString.IndexOf("年度") > 0 || u8Login.ShareString.IndexOf("日期") > 0)
                {
                    dr.ResultMsg += " - " + _date;
                }
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                errmsg = dr.ResultMsg;
                return(-1);
            }

            //清除站点
            if (!string.IsNullOrEmpty(sqlconnection))
            {
                DbHelperSQLP dsp = new DbHelperSQLP(sqlconnection);
                string       sql = string.Format("DELETE UFSystem..ua_Task WHERE cStation='{0}' AND cUser_Id='{1}' AND cAcc_Id='{2}' ", ServerName, userId, accId);
                dsp.ExecuteSql(sql);
            }

            errmsg = null;
            return(1);
        }
Ejemplo n.º 10
0
Archivo: APIOp.cs Proyecto: sky-tc/U8
        /// <summary>
        /// 获取Login对象
        /// </summary>
        /// <param name="bd"></param>
        /// <param name="u8Login"></param>
        /// <returns></returns>
        public Model.DealResult GetU8Login_bak(Model.APIData bd, U8Login.clsLogin u8Login)
        {
            System.Diagnostics.Trace.WriteLine("  begin GetU8Login  ");

            Model.DealResult dr = new Model.DealResult();

            #region 一次登录
            //if (bd.TaskType != 1 && null != _login)
            //{
            //    u8Login = _login;
            //    return dr;
            //}

            #endregion


            System.Diagnostics.Trace.WriteLine("  before  GetU8Login 判断格式 ");
            #region 判断格式  登录
            string strErr = ",请在[账套档案注册]模块中更新!";
            if (string.IsNullOrEmpty(bd.ConnectInfo.UserId))
            {
                dr.ResultMsg = "默认操作员不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.Source))
            {
                dr.ResultMsg = "数据源不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.AccId))
            {
                dr.ResultMsg = "账套号不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.Srv))
            {
                dr.ResultMsg = "服务器地址不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.YearId))
            {
                dr.ResultMsg = "登陆年度不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            else
            {
                try { int.Parse(bd.ConnectInfo.YearId); }
                catch
                {
                    dr.ResultMsg = "登陆年度格式错误:" + bd.ConnectInfo.YearId + strErr;
                    dr.ResultNum = -1;
                    Marshal.FinalReleaseComObject(u8Login);
                    throw new Exception(dr.ResultMsg);
                }
            }
            DbHelperSQLP dsp    = new DbHelperSQLP(bd.ConnectInfo.Constring);
            string       strSql = "SELECT 1 FROM UFSystem.dbo.UA_AccountDatabase A JOIN UFSystem.dbo.UA_Account B ON A.cAcc_Id=B.cAcc_Id WHERE A.cAcc_Id='" + bd.ConnectInfo.AccId + "' ";
            if (!dsp.Exists(strSql))
            {
                dr.ResultMsg = "登陆失败,原因:账套 " + bd.ConnectInfo.AccId + " 在 " + bd.ConnectInfo.Srv + " 上不存在";
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            #endregion

            System.Diagnostics.Trace.WriteLine("  after  GetU8Login 判断格式 ");

            string subId    = U8.Interface.Bus.SysInfo.subId;
            string userId   = bd.ConnectInfo.UserId;
            string accId    = bd.ConnectInfo.Source + "@" + bd.ConnectInfo.AccId;
            string yearId   = bd.ConnectInfo.YearId;
            string password = bd.ConnectInfo.Password;
            string date     = bd.ConnectInfo.Date;
            string srv      = bd.ConnectInfo.sSrv;
            string serial   = bd.ConnectInfo.Serial;


            #region 20140814

            #endregion

            System.Diagnostics.Trace.WriteLine("  before  GetU8Login u8Login.Login   ");
            System.Diagnostics.Trace.WriteLine("  login parameter :  " + subId + "----" + accId + "----" + yearId + "----" + userId + "----" + password + "----" + date + "----" + srv + "----" + serial);

            try
            {
                if (!u8Login.Login(ref subId, ref accId, ref yearId, ref userId, ref password, ref date, ref srv, ref serial))
                {
                    System.Diagnostics.Trace.WriteLine("    GetU8Login  failed  ");
                    dr.ResultMsg = "登陆失败,原因:" + u8Login.ShareString;
                    if (u8Login.ShareString.IndexOf("年度") > 0 || u8Login.ShareString.IndexOf("日期") > 0)
                    {
                        dr.ResultMsg += " - " + date;
                    }
                    dr.ResultNum = -1;
                    Marshal.FinalReleaseComObject(u8Login);
                    throw new Exception(dr.ResultMsg);
                }
            }
            catch (Exception ee)
            {
                if (dr.ResultNum == -1)
                {
                    throw new Exception(dr.ResultMsg);
                }
                else
                {
                    System.Diagnostics.Trace.WriteLine("   GetU8Login u8Login.Login Error : " + ee.StackTrace);
                    dr.ResultNum = -1;
                    throw new Exception(ee.Message);
                }
            }


            System.Diagnostics.Trace.WriteLine("  end  GetU8Login u8Login.Login ");
            System.Diagnostics.Trace.WriteLine("  end GetU8Login  ");

            //_login = u8Login;
            return(dr);
        }
Ejemplo n.º 11
0
Archivo: APIOp.cs Proyecto: sky-tc/U8
        /// <summary>
        /// 获取 vb login 和 .net login
        /// 可绕过login验证
        /// </summary>
        /// <param name="bd"></param>
        /// <param name="oSysLogin"></param>
        /// <param name="u8Login"></param>
        /// <returns></returns>
        private Model.DealResult GetU8LoginNew(Model.APIData bd, UFSoft.U8.Framework.Login.UI.clsLogin oSysLogin, U8Login.clsLogin u8Login)
        {
            Model.DealResult dr = new Model.DealResult();

            System.Diagnostics.Trace.WriteLine("  before  GetU8Login 判断格式 ");
            #region 判断格式  登录
            string strErr = ",请在[账套档案注册]模块中更新!";
            if (string.IsNullOrEmpty(bd.ConnectInfo.UserId))
            {
                dr.ResultMsg = "默认操作员不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.Source))
            {
                dr.ResultMsg = "数据源不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.AccId))
            {
                dr.ResultMsg = "账套号不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.Srv))
            {
                dr.ResultMsg = "服务器地址不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            if (string.IsNullOrEmpty(bd.ConnectInfo.YearId))
            {
                dr.ResultMsg = "登陆年度不能为空" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            else
            {
                try { int.Parse(bd.ConnectInfo.YearId); }
                catch
                {
                    dr.ResultMsg = "登陆年度格式错误:" + bd.ConnectInfo.YearId + strErr;
                    dr.ResultNum = -1;
                    Marshal.FinalReleaseComObject(u8Login);
                    throw new Exception(dr.ResultMsg);
                }
            }
            DbHelperSQLP dsp    = new DbHelperSQLP(bd.ConnectInfo.Constring);
            string       strSql = "SELECT 1 FROM UFSystem.dbo.UA_AccountDatabase A JOIN UFSystem.dbo.UA_Account B ON A.cAcc_Id=B.cAcc_Id WHERE A.cAcc_Id='" + bd.ConnectInfo.AccId + "' ";
            if (!dsp.Exists(strSql))
            {
                dr.ResultMsg = "登陆失败,原因:账套 " + bd.ConnectInfo.AccId + " 在 " + bd.ConnectInfo.Srv + " 上不存在";
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }
            #endregion

            System.Diagnostics.Trace.WriteLine("  after  GetU8Login 判断格式 ");


            bool   bLogined;
            string beginDate;

            oSysLogin = new UFSoft.U8.Framework.Login.UI.clsLogin();

            beginDate            = "";      //GetMonthBegindate(acc_ID, iYear, "12")  //用12期间构造login,12期间必有
            oSysLogin.LanguageID = "zh-CN"; // GetAccountLoginLocaleID(modUtility.GetDbName(acc_ID, iYear))

            string subId    = U8.Interface.Bus.SysInfo.subId;
            string userId   = bd.ConnectInfo.UserId;
            string accId    = bd.ConnectInfo.Source + "@" + bd.ConnectInfo.AccId;
            string yearId   = bd.ConnectInfo.YearId;
            string password = bd.ConnectInfo.Password;
            string date     = bd.ConnectInfo.Date;
            string srv      = bd.ConnectInfo.sSrv;
            string serial   = bd.ConnectInfo.Serial;

            bLogined = oSysLogin.login(subId, userId, password, srv, date, accId, serial);

            if (!bLogined)
            {
                strErr = oSysLogin.ErrDescript; //& g_fmtr.GetString("String.U8.AA.Admin.4671", g_args)
                //'strErr = oSysLogin.ErrDescript & "内置用户密码不正确!"
                //'Call WriteTransferLog(g_ologin.cAcc_ID, g_ologin.cAccName, g_ologin.cIyear, "", "准备年结环境时出现错误,错误描述:" & oSyslogin.ErrDescript & "内置用户密码不正确!")
                dr.ResultMsg = "登陆失败,原因:" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }

            UFSoft.U8.Framework.LoginContext.ProductContext oLoginContext;
            oLoginContext = new UFSoft.U8.Framework.LoginContext.ProductContext();
            oLoginContext = oSysLogin.SubLogin(U8.Interface.Bus.SysInfo.subId);

            if (null == oLoginContext)
            {
                strErr = oSysLogin.ErrDescript;
                //'MsgBox oSyslogin.ErrDescript
                //'Call WriteTransferLog(g_ologin.cAcc_ID, g_ologin.cAccName, g_ologin.cIyear, "", "准备年结环境时出现错误,错误描述:" & oSyslogin.ErrDescript)
                dr.ResultMsg = "登陆失败,原因:" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }

            //u8Login = new U8Login.clsLogin();

            if (!u8Login.ConstructLogin(oSysLogin.userToken))
            {
                strErr = u8Login.ShareString;
                //'Call WriteTransferLog(g_ologin.cAcc_ID, g_ologin.cAccName, g_ologin.cIyear, "", "准备年结环境时出现错误,错误描述:" & oLogin.ShareString)
                dr.ResultMsg = "登陆失败,原因:" + strErr;
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }

            if (!u8Login.Login(ref subId, ref accId, ref yearId, ref userId, ref password, ref date, ref srv, ref serial))
            {
                System.Diagnostics.Trace.WriteLine("    GetU8Login  failed  ");
                dr.ResultMsg = "登陆失败,原因:" + u8Login.ShareString;
                if (u8Login.ShareString.IndexOf("年度") > 0 || u8Login.ShareString.IndexOf("日期") > 0)
                {
                    dr.ResultMsg += " - " + date;
                }
                dr.ResultNum = -1;
                Marshal.FinalReleaseComObject(u8Login);
                throw new Exception(dr.ResultMsg);
            }


            return(dr);
        }