Beispiel #1
0
        public static void SetDataGridView(DataGridView dgv, string setsql, bool disable, UserCache pcs, bool isFooter)
        {
            if (dgv == null)
            {
                return;
            }

            CtrlHelper.InitDataGridView(dgv, disable);
            CreateDataGridView(dgv, SqlBaseProvider.GetFullSetSql(setsql), pcs, isFooter);
        }
Beispiel #2
0
        public static void CreateUpdateDeleteSysOnline(SysOnline item, DataProviderAction action)
        {
            if (item == null)
            {
                return;
            }

            SqlConnection conn = DBUtils.GetConnection();
            SqlCommand    cmd  = DBUtils.GetCommand();

            try
            {
                cmd.Transaction = conn.BeginTransaction();

                ArrayList paras = new ArrayList();

                paras.Add(DBUtils.MakeInParam("@Man_ID", SqlDbType.NVarChar, 6, item.ManID));
                paras.Add(DBUtils.MakeInParam("@Login_Date", SqlDbType.DateTime, Publics.GetDataDateTime(item.LoginDate)));
                paras.Add(DBUtils.MakeInParam("@Online_Date", SqlDbType.DateTime, Publics.GetDataDateTime(item.OnlineDate)));
                paras.Add(DBUtils.MakeInParam("@Menu_Code", SqlDbType.NVarChar, 4, item.MenuCode));
                paras.Add(DBUtils.MakeInParam("@Reg_ID", SqlDbType.SmallInt, item.RegID));
                paras.Add(DBUtils.MakeInParam("@Action", SqlDbType.Int, action));

                DBUtils.ExecuteNonQuery(conn, cmd, CommandType.StoredProcedure, PublicConsts.DatabaseOwner + ".P_CreateUpdateDelete_SysOnline", paras);

                if (action != DataProviderAction.Update)
                {
                    SysLog sl = new SysLog();
                    sl.LogDate   = DateTime.Now;
                    sl.ManID     = item.ManID;
                    sl.LogAction = (short)LoginAction.Info;
                    if (action == DataProviderAction.Create)
                    {
                        sl.LogContent = "登录系统";
                    }
                    else
                    {
                        sl.LogContent = "退出系统";
                    }

                    SqlBaseProvider.CreateUpdateDeleteSysLog(sl, DataProviderAction.Create);
                }

                cmd.Transaction.Commit();
            }
            catch
            {
                cmd.Transaction.Rollback();
                throw;
            }
            finally
            {
                DBUtils.SetDispose(conn, cmd);
            }
        }
Beispiel #3
0
        public static UserCache GetLoginInfo(string manid, string reginfo, string password)
        {
            UserCache uc = new UserCache();

            try
            {
                ArrayList paras = new ArrayList();
                paras.Add(DBUtils.MakeInParam("@Man_ID", SqlDbType.NVarChar, 6, manid));

                SqlDataReader reader = DBUtils.ExecuteReader(CommandType.StoredProcedure, PublicConsts.DatabaseOwner + ".P_Valid_Login", paras);

                if (reader.Read())
                {
                    uc.Company = SqlBaseProvider.PopulateSysCompany(reader);
                }

                if (reader.NextResult())
                {
                    if (reader.Read())
                    {
                        uc.Dept = SqlBaseProvider.PopulateSysDept(reader);
                    }
                }

                if (reader.NextResult())
                {
                    if (reader.Read())
                    {
                        uc.Man = SqlBaseProvider.PopulateSysMan(reader);
                    }
                }

                if (reader.NextResult())
                {
                    if (reader.Read())
                    {
                        uc.Dept.DeptFlow = (short)reader["Dept_Flow"];
                    }
                }

                reader.Close();
            }
            catch
            {
            }

            return(uc);
        }