Ejemplo n.º 1
0
        private bool ReadCard()
        {
            countTimes       = 0;
            countMoney       = 0;
            CardDepositLimit = 0;
            CardDepositTimes = 0;
            CardData10       = "";
            CardDataH        = "";
            CardData8        = "";
            EmpSysID         = "";
            if (!Pub.CheckCardExists(ref CardData10, ref CardDataH, ref CardData8))
            {
                return(false);
            }
            pubData = new HSUNFK.TCardPubData();
            sfData  = new HSUNFK.TCardSFData();
            if (!Pub.ReadCardInfo(ref pubData, ref sfData))
            {
                return(false);
            }
            if (!db.CheckCardExists(pubData.CardNo, CardData10))
            {
                return(false);
            }
            DateTime dt = new DateTime();

            if (!db.GetServerDate(ref dt))
            {
                return(false);
            }
            if (!Pub.CheckCardValidDate(dt, pubData.CardBeginDate, pubData.CardEndDate))
            {
                return(false);
            }
            DataTableReader dr   = null;
            bool            IsOk = false;

            try
            {
                if (!db.IsOpen)
                {
                    db.Open(SystemInfo.ConnStr);
                }
                if (!db.CheckDepartPowerByCard(pubData.CardNo))
                {
                    return(false);
                }
                dr = db.GetDataReader(Pub.GetSQL(DBCode.DB_001003, new string[] { "215", pubData.CardNo }));
                if (dr.Read())
                {
                    if (Convert.ToInt32(dr["CardStatusID"]) != 20)
                    {
                        Pub.ShowErrorMsg(Pub.GetResText(formCode, "MsgCardDepositNotNormal", ""));
                    }
                    else
                    {
                        EmpSysID               = dr["EmpSysID"].ToString();
                        txtEmpNo.Text          = dr["EmpNo"].ToString();
                        txtEmpName.Text        = dr["EmpName"].ToString();
                        txtDepartName.Text     = dr["DepartName"].ToString();
                        txtCardSectorNo.Text   = dr["CardSectorNo"].ToString();
                        txtCardStatusName.Text = dr["CardStatusName"].ToString();
                        txtCardType.Text       = dr["CardTypeName"].ToString();
                        int.TryParse(dr["DepositDiscount"].ToString(), out Discount);
                        txtDepositDiscount.Text = Discount.ToString();
                        double.TryParse(dr["CardDepositLimit"].ToString(), out CardDepositLimit);
                        int.TryParse(dr["CardDepositTimes"].ToString(), out CardDepositTimes);
                        IsOk = true;
                    }
                }
                else
                {
                    Pub.ShowErrorMsg(Pub.GetResText("", "ErrorIllegalCard", ""));
                }
            }
            catch (Exception E)
            {
                Pub.ShowErrorMsg(E);
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
            }
            if (IsOk && SystemInfo.AllowCheckDepositLimit == 3)
            {
                IsOk = false;
                try
                {
                    dr = db.GetDataReader(Pub.GetSQL(DBCode.DB_004013, new string[] { "200", EmpSysID }));
                    if (dr.Read())
                    {
                        double.TryParse(dr["SFAmount"].ToString(), out countMoney);
                        int.TryParse(dr["Times"].ToString(), out countTimes);
                        IsOk = true;
                    }
                }
                catch (Exception E)
                {
                    Pub.ShowErrorMsg(E);
                }
                finally
                {
                    if (dr != null)
                    {
                        dr.Close();
                    }
                    dr = null;
                }
            }
            return(IsOk);
        }
Ejemplo n.º 2
0
        private bool ReadCard()
        {
            CardData10 = "";
            CardDataH  = "";
            CardData8  = "";
            if (!Pub.CheckCardExists(ref CardData10, ref CardDataH, ref CardData8))
            {
                return(false);
            }
            pubData = new HSUNFK.TCardPubData();
            sfData  = new HSUNFK.TCardSFData();
            if (!Pub.ReadCardInfo(ref pubData, ref sfData))
            {
                return(false);
            }
            if (!db.CheckCardExists(pubData.CardNo, CardData10))
            {
                return(false);
            }
            DateTime dt = new DateTime();

            if (!db.GetServerDate(ref dt))
            {
                return(false);
            }
            if (!Pub.CheckCardValidDate(dt, pubData.CardBeginDate, pubData.CardEndDate))
            {
                return(false);
            }
            DataTableReader dr   = null;
            bool            IsOk = false;

            try
            {
                if (!db.IsOpen)
                {
                    db.Open(SystemInfo.ConnStr);
                }
                if (!db.CheckDepartPowerByCard(pubData.CardNo))
                {
                    return(false);
                }
                if (pubData.CardNo != GetCardNo())
                {
                    Pub.ShowErrorMsg(Pub.GetResText(formCode, "ErrorCard", ""));
                    return(false);
                }
                dr = db.GetDataReader(Pub.GetSQL(DBCode.DB_001003, new string[] { "215", pubData.CardNo }));
                if (dr.Read())
                {
                    if (Convert.ToInt32(dr["CardStatusID"]) != 20)
                    {
                        Pub.ShowErrorMsg(Pub.GetResText(formCode, "MsgCardRefunNotNormal", ""));
                    }
                    else if (!Convert.ToBoolean(dr["CardRefundment"].ToString()))
                    {
                        Pub.ShowErrorMsg(string.Format(Pub.GetResText("", "ErrorCardRefundment", ""),
                                                       dr["CardTypeName"].ToString()));
                    }
                    else
                    {
                        IsOk = true;
                    }
                }
                else
                {
                    Pub.ShowErrorMsg(Pub.GetResText("", "ErrorIllegalCard", ""));
                }
            }
            catch (Exception E)
            {
                Pub.ShowErrorMsg(E);
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
            }
            return(IsOk);
        }
Ejemplo n.º 3
0
        private bool ReadCard(byte flag)
        {
            CardDepositLimit = 0;
            CardDepositTimes = 0;
            CardData10       = "";
            CardDataH        = "";
            CardData8        = "";
            if (!Pub.CheckCardExists(ref CardData10, ref CardDataH, ref CardData8))
            {
                return(false);
            }
            pubData = new HSUNFK.TCardPubData();
            sfData  = new HSUNFK.TCardSFData();
            if (!Pub.ReadCardInfo(ref pubData, ref sfData))
            {
                return(false);
            }
            if (!db.CheckCardExists(pubData.CardNo, CardData10))
            {
                return(false);
            }
            DateTime dt = new DateTime();

            if (!db.GetServerDate(ref dt))
            {
                return(false);
            }
            if (!Pub.CheckCardValidDate(dt, pubData.CardBeginDate, pubData.CardEndDate))
            {
                return(false);
            }
            DataTableReader dr   = null;
            bool            IsOk = false;

            try
            {
                if (!db.IsOpen)
                {
                    db.Open(SystemInfo.ConnStr);
                }
                if (!db.CheckDepartPowerByCard(pubData.CardNo))
                {
                    return(false);
                }
                dr = db.GetDataReader(Pub.GetSQL(DBCode.DB_001003, new string[] { "215", pubData.CardNo }));
                if (dr.Read())
                {
                    if (Convert.ToInt32(dr["CardStatusID"]) != 20)
                    {
                        if (flag == 0)
                        {
                            Pub.ShowErrorMsg(Pub.GetResText(formCode, "MsgCardDepositNotNormal", ""));
                        }
                        else
                        {
                            Pub.ShowErrorMsg(Pub.GetResText(formCode, "MsgCardRefunNotNormal", ""));
                        }
                    }
                    else if (flag != 0 && !Convert.ToBoolean(dr["CardRefundment"].ToString()))
                    {
                        Pub.ShowErrorMsg(string.Format(Pub.GetResText("", "ErrorCardRefundment", ""),
                                                       dr["CardTypeName"].ToString()));
                    }
                    else
                    {
                        IsOk = true;
                        if (flag == 0)
                        {
                            txtEmpNo.Text          = dr["EmpNo"].ToString();
                            txtEmpName.Text        = dr["EmpName"].ToString();
                            txtDepartName.Text     = dr["DepartName"].ToString();
                            txtCardSectorNo.Text   = dr["CardSectorNo"].ToString();
                            txtCardStatusName.Text = dr["CardStatusName"].ToString();
                            txtCardType.Text       = dr["CardTypeName"].ToString();
                            int.TryParse(dr["DepositDiscount"].ToString(), out Discount);
                            txtDepositDiscount.Text = Discount.ToString();
                            double.TryParse(dr["CardDepositLimit"].ToString(), out CardDepositLimit);
                            int.TryParse(dr["CardDepositTimes"].ToString(), out CardDepositTimes);
                        }
                        else
                        {
                            if (ExistsDepositType)
                            {
                                string SFTypeName = "";
                                double SFAmount   = 0;
                                IsOk = db.SFGetLastSFType(dr["EmpSysID"].ToString(), ref SFTypeName, ref SFAmount);
                                if (IsOk && (SFTypeName != ""))
                                {
                                    txtUpDepositType.Text = SFTypeName + ":" + SFAmount.ToString(SystemInfo.CurrencySymbol + "0.00");
                                }
                            }
                            if (IsOk)
                            {
                                textBox8.Text = dr["EmpNo"].ToString();
                                textBox9.Text = dr["EmpName"].ToString();
                                textBox7.Text = dr["DepartName"].ToString();
                                textBox5.Text = dr["CardSectorNo"].ToString();
                                textBox6.Text = dr["CardStatusName"].ToString();
                                textBox4.Text = dr["CardTypeName"].ToString();
                            }
                        }
                    }
                }
                else
                {
                    Pub.ShowErrorMsg(Pub.GetResText("", "ErrorIllegalCard", ""));
                }
            }
            catch (Exception E)
            {
                Pub.ShowErrorMsg(E);
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
            }

            return(IsOk);
        }
Ejemplo n.º 4
0
        private bool ReadCard()
        {
            CardData10 = "";
            CardDataH  = "";
            CardData8  = "";
            if (!Pub.CheckCardExists(ref CardData10, ref CardDataH, ref CardData8))
            {
                return(false);
            }
            pubData = new QHAPI.TCardPubData();
            sfData  = new QHAPI.TCardSFData();
            if (!Pub.ReadCardInfo(ref pubData, ref sfData))
            {
                return(false);
            }
            if (!db.CheckCardExists(pubData.CardNo, CardData10))
            {
                return(false);
            }
            DateTime dt = new DateTime();

            if (!db.GetServerDate(ref dt))
            {
                return(false);
            }
            if (!Pub.CheckCardValidDate(dt, pubData.CardBeginDate, pubData.CardEndDate))
            {
                return(false);
            }
            DataTableReader dr   = null;
            bool            IsOk = false;

            try
            {
                if (!db.IsOpen)
                {
                    db.Open(SystemInfo.ConnStr);
                }
                if (!db.CheckDepartPowerByCard(pubData.CardNo))
                {
                    return(false);
                }
                dr = db.GetDataReader(Pub.GetSQL(DBCode.DB_001003, new string[] { "215", pubData.CardNo }));
                if (dr.Read())
                {
                    if (Convert.ToInt32(dr["CardStatusID"]) != 20)
                    {
                        Pub.MessageBoxShow(Pub.GetResText(formCode, "MsgCardRefunNotNormal", ""));
                    }
                    else
                    {
                        IsOk = true;
                        if (SystemInfo.HasMoreDepositType)
                        {
                            string SFTypeName = "";
                            double SFAmount   = 0;
                            IsOk = db.SFGetLastSFType(dr["EmpSysID"].ToString(), ref SFTypeName, ref SFAmount);
                            if (IsOk && (SFTypeName != ""))
                            {
                                txtCardBalanceBT.Text = SFTypeName + ":" + SFAmount.ToString(SystemInfo.CurrencySymbol + "0.00");
                            }
                        }
                        if (IsOk)
                        {
                            txtEmpNo.Text          = dr["EmpNo"].ToString();
                            txtEmpName.Text        = dr["EmpName"].ToString();
                            txtDepartName.Text     = dr["DepartName"].ToString();
                            txtCardSectorNo.Text   = dr["CardSectorNo"].ToString();
                            txtCardStatusName.Text = dr["CardStatusName"].ToString();
                            txtCardType.Text       = dr["CardTypeName"].ToString();
                        }
                    }
                }
                else
                {
                    Pub.MessageBoxShow(Pub.GetResText("", "ErrorIllegalCard", ""));
                }
            }
            catch (Exception E)
            {
                Pub.ShowErrorMsg(E);
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
            }
            return(IsOk);
        }
Ejemplo n.º 5
0
        private bool ReadCard(bool IsWrite)
        {
            CardData10 = "";
            CardDataH  = "";
            CardData8  = "";
            if (!Pub.CheckCardExists(ref CardData10, ref CardDataH, ref CardData8))
            {
                return(false);
            }
            pubData = new QHAPI.TCardPubData();
            sfData  = new QHAPI.TCardSFData();
            if (!Pub.ReadCardInfo(ref pubData, ref sfData))
            {
                return(false);
            }
            if (!db.CheckCardExists(pubData.CardNo, CardData10))
            {
                return(false);
            }
            DateTime dt = new DateTime();

            if (!db.GetServerDate(ref dt))
            {
                return(false);
            }
            if (!Pub.CheckCardValidDate(dt, pubData.CardBeginDate, pubData.CardEndDate))
            {
                return(false);
            }
            DataTableReader dr   = null;
            bool            IsOk = false;

            try
            {
                if (!db.IsOpen)
                {
                    db.Open(SystemInfo.ConnStr);
                }
                if (!db.CheckDepartPowerByCard(pubData.CardNo))
                {
                    return(false);
                }
                dr = db.GetDataReader(Pub.GetSQL(DBCode.DB_001003, new string[] { "215", pubData.CardNo }));
                if (dr.Read())
                {
                    if (Convert.ToInt32(dr["CardStatusID"]) != 20)
                    {
                        Pub.MessageBoxShow(Pub.GetResText(formCode, "MsgCardCostNotNormal", ""));
                    }
                    else
                    {
                        txtEmpNo.Text          = dr["EmpNo"].ToString();
                        txtEmpName.Text        = dr["EmpName"].ToString();
                        txtDepartName.Text     = dr["DepartName"].ToString();
                        txtCardSectorNo.Text   = dr["CardSectorNo"].ToString();
                        txtCardStatusName.Text = dr["CardStatusName"].ToString();
                        txtCardType.Text       = dr["CardTypeName"].ToString();
                        IsOk = true;
                    }
                }
                else
                {
                    Pub.MessageBoxShow(Pub.GetResText("", "ErrorIllegalCard", ""));
                }
            }
            catch (Exception E)
            {
                Pub.ShowErrorMsg(E);
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
            }
            return(IsOk);
        }