예제 #1
0
        public POSInfo Get(
            String USER_ID,
            ref string sErr)
        {
            POSInfo objEntr = new POSInfo();

            connect();
            InitSPCommand(_strSPGetName);
            AddParameter("USER_ID", USER_ID);

            DataTable list = new DataTable();

            try
            {
                list = executeSelectSP(command);
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
            }
            disconnect();

            if (list.Rows.Count > 0)
            {
                objEntr = (POSInfo)GetDataFromDataRow(list, 0);
            }
            //if (dr != null) list = CBO.FillCollection(dr, ref list);
            if (sErr != "")
            {
                ErrorLog.SetLog(sErr);
            }
            return(objEntr);
        }
예제 #2
0
        public DataTableCollection Get_Page(POSInfo obj, string orderBy, int pageIndex, int pageSize, ref String sErr)
        {
            string whereClause         = CreateWhereClause(obj);
            DataTableCollection dtList = null;

            connect();
            InitSPCommand(_strSPGetPages);

            AddParameter("WhereClause", whereClause);
            AddParameter("OrderBy", orderBy);
            AddParameter("PageIndex", pageIndex);
            AddParameter("PageSize", pageSize);

            try
            {
                dtList = executeCollectSelectSP();
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
            }
            disconnect();
            if (sErr != "")
            {
                ErrorLog.SetLog(sErr);
            }
            return(dtList);
        }
예제 #3
0
        public string Update(POSInfo objEntr)
        {
            connect();
            InitSPCommand(_strSPUpdateName);
            AddParameter("USER_ID", objEntr.USER_ID);
            AddParameter("CURRENT_DB", objEntr.CURRENT_DB);
            AddParameter("CURRENT_ACTIVITY", objEntr.CURRENT_ACTIVITY);
            AddParameter("WORK_STATION", objEntr.WORK_STATION);
            AddParameter("LOGIN_TIME", objEntr.LOGIN_TIME);

            string sErr = "";

            try
            {
                excuteSPNonQuery();
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
            }
            disconnect();
            if (sErr != "")
            {
                ErrorLog.SetLog(sErr);
            }
            return(sErr);
        }
예제 #4
0
        protected override object GetDataFromDataRow(DataTable dt, int i)
        {
            POSInfo result = new POSInfo();

            result.USER_ID          = (dt.Rows[i]["USER_ID"] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i]["USER_ID"]));
            result.CURRENT_DB       = (dt.Rows[i]["CURRENT_DB"] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i]["CURRENT_DB"]));
            result.CURRENT_ACTIVITY = (dt.Rows[i]["CURRENT_ACTIVITY"] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i]["CURRENT_ACTIVITY"]));
            result.WORK_STATION     = (dt.Rows[i]["WORK_STATION"] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i]["WORK_STATION"]));
            result.LOGIN_TIME       = (dt.Rows[i]["LOGIN_TIME"] == DBNull.Value ? "" : Convert.ToString(dt.Rows[i]["LOGIN_TIME"]));

            return(result);
        }
예제 #5
0
파일: frmLogin.cs 프로젝트: mwilian/demos
        private void btnLogin_Click(object sender, EventArgs e)
        {
            PODInfo inf = new PODInfo();

            _user = inf.USER_ID = txtUser.Text;
            _pass = inf.PASS = txtPass.Text;

            if (_user != "TVC" || _pass != "TVCSYS")
            {
                inf.LANGUAGE = "44";
                BUS.PODControl podCtr = new BUS.PODControl();
                if (podCtr.IsExist(inf.USER_ID))
                {
                    string pass = Convert.ToBase64String(new System.Security.Cryptography.SHA1CryptoServiceProvider().ComputeHash(Encoding.ASCII.GetBytes(inf.PASS)));

                    inf          = podCtr.Get(inf.USER_ID, ref _sErr);
                    inf.LANGUAGE = inf.LANGUAGE == "84" ? "84" : "44";

                    if (inf.PASS == pass)
                    {
                        BUS.POSControl posCtr = new BUS.POSControl();
                        if (!posCtr.IsExist(inf.USER_ID))
                        {
                            DialogResult = DialogResult.OK;
                            _DB          = inf.DB_DEFAULT;

                            DTO.POSInfo infPOS = new POSInfo(inf.USER_ID, _DB, "Query Designer", "QD", DateTime.Now.ToString("yyyy-MM-dd hh:mm"));
                            posCtr.InsertUpdate(infPOS);
                            Close();
                        }
                        else
                        {
                            lbErr.Text = "Existing users in the system";
                        }
                    }
                    else
                    {
                        lbErr.Text = "Password wrong!";
                    }
                }
                else
                {
                    lbErr.Text = "User is not exist!";
                }
            }
            else
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }
예제 #6
0
        public string InsertUpdate(POSInfo obj)
        {
            string sErr = "";

            if (IsExist(
                    obj.USER_ID
                    ))
            {
                sErr = Update(obj);
            }
            else
            {
                Add(obj, ref sErr);
            }
            return(sErr);
        }
예제 #7
0
        /// <summary>
        /// Return 1: Table is exist Identity Field
        /// Return 0: Table is not exist Identity Field
        /// Return -1: Erro
        /// </summary>
        /// <param name="tableName"></param>
        public Int32 Add(POSInfo objEntr, ref string sErr)
        {
            int ret = -1;

            connect();
            InitSPCommand(_strSPInsertName);
            AddParameter("USER_ID", objEntr.USER_ID);
            AddParameter("CURRENT_DB", objEntr.CURRENT_DB);
            AddParameter("CURRENT_ACTIVITY", objEntr.CURRENT_ACTIVITY);
            AddParameter("WORK_STATION", objEntr.WORK_STATION);
            AddParameter("LOGIN_TIME", objEntr.LOGIN_TIME);

            try
            {
                //command.ExecuteNonQuery();
                object tmp = executeSPScalar();
                if (tmp != null && tmp != DBNull.Value)
                {
                    ret = Convert.ToInt32(tmp);
                }
                else
                {
                    ret = 0;
                }
            }
            catch (Exception ex)
            {
                sErr = ex.Message;
            }
            disconnect();
            if (sErr != "")
            {
                ErrorLog.SetLog(sErr);
            }

            return(ret);
        }
예제 #8
0
        /*  public string Delete(String arrID)
         * {
         *    string kq = "";
         *    string[] arrStrID = arrID.Split(',');
         *    foreach (string strID in arrStrID)
         *    {
         *        if (strID != "")
         *        {
         *            int ID = Convert.ToInt32(strID);
         *            kq += _POSDAO.Delete(ID);
         *        }
         *    }
         *    return kq;
         * } */

        public DataTableCollection Get_Page(POSInfo obj, string orderBy, int pageIndex, int pageSize, ref String sErr)
        {
            return(_POSDAO.Get_Page(obj, orderBy, pageIndex, pageSize, ref sErr));
        }
예제 #9
0
 public string Update(POSInfo obj)
 {
     return(_POSDAO.Update(obj));
 }
예제 #10
0
 public Int32 Add(POSInfo obj, ref string sErr)
 {
     return(_POSDAO.Add(obj, ref sErr));
 }
예제 #11
0
        private string CreateWhereClause(POSInfo obj)
        {
            String result = "";

            return(result);
        }