Ejemplo n.º 1
0
        public string PersonerInfo(string CardSn)
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                if (ConfigurationManager.AppSettings["CofeePosCardType"] == "1")
                {
                    CardSn = (100000000 + DeCode1(CardSn)).ToString().Remove(0, 1);
                }
                string ConnString = ConfigurationManager.AppSettings["cfsf"];
                nrWebClass.DAL.SqlDbHelper dal       = new nrWebClass.DAL.SqlDbHelper(ConnString);
                SqlParameter[]             paramters = new SqlParameter[] {
                    new SqlParameter("@CardSn", int.Parse(CardSn))
                };
                LiLanzDAL dal2 = new LiLanzDAL();

                using (IDataReader reader = dal.ExecuteReader(@"select t2.DeptName,CardSnr,CustomerName,
t1.CustomerNo,t2.DeptNo,t1.AccountNo,isnull(t1.AccStat,0),isnull(t1.CardStat,0),t1.sex
from tb_Customer_coffee as t1
inner join tb_Department as t2 on t1.DeptNo=t2.DeptNo where CardSnr=@CardSn", CommandType.Text, paramters))
                {
                    if (reader.Read())
                    {
                        if (reader[6].ToString() == "0" && reader[7].ToString() == "0")
                        {
                            int isLeave = 0;
                            if (IsLeave(reader[5].ToString()))
                            {
                                isLeave = 1;
                            }

                            sb.Append("<?xml version=\"1.0\" encoding=\"gb2312\"?>");
                            sb.Append(String.Format("<CardInfo Dept=\"{0}\" CardNo=\"{1}\" Cname=\"{2}\" PersonSn=\"{3}\" DeptNo=\"{4}\" AccountNo=\"{5}\" Sex=\"{6}\" isLeave=\"{7}\">",
                                                    reader[0], CardSnFill(reader[1].ToString()), reader[2], reader[3], reader[4], reader[5], reader["sex"], isLeave));
                            sb.Append("</CardInfo>");
                        }
                        //SqlParameter[] paramters2 = new SqlParameter[]{
                        //  new SqlParameter("@AccountNo", int.Parse(reader[5].ToString()))
                        //};
                        //if (dal2.ExecuteScalar("select 1 from cy_t_coffeeStopSign where AccountNo=@AccountNo",
                        //    CommandType.Text, paramters2) != null)
                        //    sb.Length = 0;
                    }
                    reader.Dispose();
                }
            }
            catch (Exception ex)
            {
                sb.Append(ex.ToString());
            }
            return(sb.ToString());
        }
Ejemplo n.º 2
0
        public string PersonerInfoNoEncrypt(string CardSn)
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                string ConnString = ConfigurationManager.AppSettings["cfsf"];
                nrWebClass.DAL.SqlDbHelper dal       = new nrWebClass.DAL.SqlDbHelper(ConnString);
                SqlParameter[]             paramters = new SqlParameter[] {
                    new SqlParameter("@CardSn", int.Parse(CardSn))
                };
                IDataReader reader = dal.ExecuteReader(@"select t2.DeptName,CardSnr,CustomerName,
t1.CustomerNo,t2.DeptNo,t1.AccountNo,isnull(t1.AccStat,0) AccStat,isnull(t1.CardStat,0) CardStat,t1.sex
from tb_Customer_coffee as t1
inner join tb_Department as t2 on t1.DeptNo=t2.DeptNo where CardSnr=@CardSn", CommandType.Text, paramters);
                if (reader.Read())
                {
                    if (reader[6].ToString() == "0" && reader[7].ToString() == "0")
                    {
                        int isLeave = 0;
                        if (IsLeave(reader[5].ToString()))
                        {
                            isLeave = 1;
                        }

                        //Log.Info(IsLeave(reader[5].ToString()).ToString());

                        sb.Append("<?xml version=\"1.0\" encoding=\"gb2312\"?>");
                        sb.Append(String.Format("<CardInfo Dept=\"{0}\" CardNo=\"{1}\" Cname=\"{2}\" PersonSn=\"{3}\" DeptNo=\"{4}\" AccountNo=\"{5}\" Sex=\"{6}\" isLeave=\"{7}\">",
                                                reader[0], CardSnFill(reader[1].ToString()), reader[2], reader[3], reader[4], reader[5], reader["sex"], isLeave));
                        sb.Append("</CardInfo>");
                    }
                }
                reader.Dispose();
            }
            catch (Exception ex)
            {
                sb.Append(ex.ToString());
            }
            finally
            {
            }
            return(sb.ToString());
        }