Пример #1
0
        public int SaveMonthQuarterTicket(SoatVeTransactionModel item)
        {
            try
            {
                using (SqlCommand cmd = TKUtils.InitCommand("Add_SoatVeThangQui"))
                {
                    // Add param
                    cmd.Parameters.Add("@Result", SqlDbType.Int).Direction     = ParameterDirection.Output;
                    cmd.Parameters.Add("@sGioSoat", SqlDbType.Int).Value       = CheckTime;
                    cmd.Parameters.Add("@sNgaySoat", SqlDbType.DateTime).Value =
                        new DateTime(int.Parse(item.CheckDate.Split('/')[2].Split(' ')[0]),
                                     int.Parse(item.CheckDate.Split('/')[0]), int.Parse(item.CheckDate.Split('/')[1]));
                    cmd.Parameters.Add("@sMSLane", SqlDbType.VarChar, 3).Value   = LaneID;
                    cmd.Parameters.Add("@sLogin", SqlDbType.VarChar, 20).Value   = LoginID;
                    cmd.Parameters.Add("@sCa", SqlDbType.VarChar, 3).Value       = ShiftID;
                    cmd.Parameters.Add("@sMSLoaiXe", SqlDbType.VarChar, 2).Value = "";
                    //biến checker hiện giờ dùng chứa datestring
                    cmd.Parameters.Add("@sChecker", SqlDbType.VarChar, 20).Value = item.CheckDate;
                    cmd.Parameters.Add("@sSoXe", SqlDbType.VarChar, 20).Value    = item.RecogPlateNumber;

                    cmd.Parameters.Add("@sF0", SqlDbType.VarChar, 1).Value        = F0;
                    cmd.Parameters.Add("@sF1", SqlDbType.VarChar, 1).Value        = F1;
                    cmd.Parameters.Add("@sF2", SqlDbType.VarChar, 1).Value        = F2;
                    cmd.Parameters.Add("@sImageId", SqlDbType.NVarChar, 20).Value = item.ImageID;
                    cmd.Parameters.Add("@sTID", SqlDbType.VarChar, 20).Value      = TicketID;

                    if (item.TicketID.Substring(0, 1) == "B")
                    {
                        cmd.Parameters.Add("@sMSLoaiVe", SqlDbType.VarChar, 2).Value = "2" + item.VehicleClassID;
                    }
                    else if (item.TicketID.Substring(0, 1) == "C")
                    {
                        cmd.Parameters.Add("@sMSLoaiVe", SqlDbType.VarChar, 2).Value = "3" + item.VehicleClassID;
                    }

                    cmd.Parameters.Add("@sGiaVe", SqlDbType.Int).Value = item.ChargeAmount;
                    //if (this.SFTPUsername.Equals("station0075"))
                    //{
                    //    cmd.Parameters.Add("@sMSTram", SqlDbType.VarChar, 1).Value = StationID;
                    //}
                    //Tam add
                    cmd.Parameters.Add("@sEtagID", SqlDbType.VarChar, 24).Value = "";

                    // Thuc thi stored
                    ExecuteNonQuery(cmd);

                    // Kiem tra ket qua
                    int retValue = int.Parse(cmd.Parameters["@Result"].Value.ToString());

                    return((retValue > 0) ? 1 : 0);
                }
            }
            catch (Exception ex)
            {
                TKUtils.WriteLogFile(GetType() + "." + MethodBase.GetCurrentMethod().Name,
                                     ex.Message); //STORED_MONTH_QUARTER_TICKET, ex.Message);
                return(0);
            }
        }
Пример #2
0
        public int SaveForceOpen(SoatVeTransactionModel item)
        {
            try
            {
                using (SqlCommand cmd = TKUtils.InitCommand("Add_ForceOpen"))
                {
                    // Add param
                    cmd.Parameters.Add("@Result", SqlDbType.Int).Direction     = ParameterDirection.Output;
                    cmd.Parameters.Add("@sTID", SqlDbType.VarChar, 20).Value   = TicketID;
                    cmd.Parameters.Add("@sMSLane", SqlDbType.VarChar, 3).Value = LaneID;
                    cmd.Parameters.Add("@sLogin", SqlDbType.VarChar, 20).Value = LoginID;
                    cmd.Parameters.Add("@sCa", SqlDbType.VarChar, 3).Value     = ShiftID;
                    cmd.Parameters.Add("@sGioMo", SqlDbType.Int).Value         = CheckTime;
                    cmd.Parameters.Add("@sNgaySoat", SqlDbType.DateTime).Value =
                        new DateTime(int.Parse(item.CheckDate.Split('/')[2].Split(' ')[0]),
                                     int.Parse(item.CheckDate.Split('/')[0]), int.Parse(item.CheckDate.Split('/')[1]));
                    cmd.Parameters.Add("@sGioDong", SqlDbType.Int).Value       = CheckTime;
                    cmd.Parameters.Add("@sNgayDong", SqlDbType.DateTime).Value =
                        new DateTime(int.Parse(item.CheckDate.Split('/')[2].Split(' ')[0]),
                                     int.Parse(item.CheckDate.Split('/')[0]), int.Parse(item.CheckDate.Split('/')[1]));
                    //cmd.Parameters.Add("@sTramID", SqlDbType.Int).Value = StationID;
                    //cmd.Parameters.Add("@sReason", SqlDbType.Int).Value = Reason;
                    //cmd.Parameters.Add("@sTicketType", SqlDbType.Int).Value = Reason; // (int)Category;????
                    //Biến checker chỗ này hiện giờ dùng chứa datestring
                    cmd.Parameters.Add("@sChecker", SqlDbType.VarChar, 20).Value  = item.Checker;
                    cmd.Parameters.Add("@sSoXe", SqlDbType.VarChar, 20).Value     = item.RecogPlateNumber;
                    cmd.Parameters.Add("@sF0", SqlDbType.VarChar, 1).Value        = F0;
                    cmd.Parameters.Add("@sF1", SqlDbType.VarChar, 1).Value        = F1;
                    cmd.Parameters.Add("@sF2", SqlDbType.VarChar, 1).Value        = F2;
                    cmd.Parameters.Add("@sImageId", SqlDbType.NVarChar, 20).Value = item.ImageID;
                    //if (this.SFTPUsername.Equals("station0075"))
                    //{
                    //    cmd.Parameters.Add("@sMSTram", SqlDbType.VarChar, 1).Value = StationID;
                    //}
                    //Tam add
                    cmd.Parameters.Add("@sEtagID", SqlDbType.VarChar, 24).Value = "";

                    // Thuc thi stored
                    ExecuteNonQuery(cmd);

                    // Kiem tra ket qua
                    int retValue = int.Parse(cmd.Parameters["@Result"].Value.ToString());

                    return((retValue > 0) ? 1 : 0);
                }
            }
            catch (Exception ex)
            {
                TKUtils.WriteLogFile(GetType() + "." + MethodBase.GetCurrentMethod().Name,
                                     ex.Message); //STORED_FORCE_TICKET+Category.ToString(), ex.Message);
            }
            return(0);
        }
Пример #3
0
        public int CommitRFID(SoatVeTransactionModel item)
        {
            int        res = 0;
            SqlCommand cmd = null;

            try
            {
                using (cmd = TKUtils.InitCommand("TRP_spCheckObuAccount_RFID"))
                {
                    cmd.Parameters.Add("@Activity", SqlDbType.NVarChar, 50).Value       = "Save";
                    cmd.Parameters.Add("@ReturnMsg", SqlDbType.NVarChar, 500).Direction = ParameterDirection.Output;
                    cmd.Parameters.Add("@ReturnValue", SqlDbType.Int).Direction         = ParameterDirection.Output;

                    cmd.Parameters.Add("@ObuID", SqlDbType.NVarChar).Value = item.ObuID;
                    var dt = new DateTime(int.Parse(item.ImageID.Substring(0, 4)),
                                          int.Parse(item.ImageID.Substring(4, 2)), int.Parse(item.ImageID.Substring(6, 2)),
                                          int.Parse(item.ImageID.Substring(8, 2)), int.Parse(item.ImageID.Substring(10, 2)),
                                          int.Parse(item.ImageID.Substring(12, 2)), int.Parse(item.ImageID.Substring(14, 3)));
                    cmd.Parameters.Add("@CheckDate", SqlDbType.DateTime).Value = dt;

                    cmd.Parameters.Add("@CheckTime", SqlDbType.Int).Value      = item.CheckTime;
                    cmd.Parameters.Add("@BeginBalance", SqlDbType.Int).Value   = item.BeginBalance;
                    cmd.Parameters.Add("@ChargeAmount", SqlDbType.Int).Value   = item.ChargeAmount;   //
                    cmd.Parameters.Add("@Balance", SqlDbType.Int).Value        = 0;
                    cmd.Parameters.Add("@VehicleClassID", SqlDbType.Int).Value = item.VehicleClassID; //vehicle type
                    if (string.IsNullOrEmpty(item.LoginID))
                    {
                        cmd.Parameters.Add("@LoginID", SqlDbType.NVarChar).Value = "0000";
                        //nhan vien mac dinh, chua login
                    }
                    else
                    {
                        cmd.Parameters.Add("@LoginID", SqlDbType.NVarChar).Value = item.LoginID;
                    }
                    cmd.Parameters.Add("@LaneID", SqlDbType.NVarChar).Value            = item.LaneID;
                    cmd.Parameters.Add("@ShiftID", SqlDbType.NVarChar).Value           = item.ShiftID;
                    cmd.Parameters.Add("@StationID", SqlDbType.NVarChar).Value         = item.StationID;
                    cmd.Parameters.Add("@RegisPlateNumber", SqlDbType.NVarChar).Value  = item.RegisPlateNumber;
                    cmd.Parameters.Add("@PlateType", SqlDbType.SmallInt).Value         = item.PlateType;
                    cmd.Parameters.Add("@RecogPlateNumber", SqlDbType.NVarChar).Value  = item.RecogPlateNumber;
                    cmd.Parameters.Add("@IsIntelligentVeriField", SqlDbType.Bit).Value = false;
                    cmd.Parameters.Add("@IntelVerifyResult", SqlDbType.SmallInt).Value = item.IntelVerifyResult;
                    cmd.Parameters.Add("@ImageID", SqlDbType.NVarChar).Value           = item.ImageID;
                    cmd.Parameters.Add("@ImageStatus", SqlDbType.Int).Value            = ImageStatus;        //VDH 30july
                    cmd.Parameters.Add("@IsOnlineCheck", SqlDbType.Int).Value          = item.IsOnlineCheck; //VDH 30july
                    cmd.Parameters.Add("@PeriodTicket", SqlDbType.Int).Value           = item.PeriodTicket;
                    cmd.Parameters.Add("@Checker", SqlDbType.VarChar, 20).Value        = item.Checker;
                    cmd.Parameters.Add("@F0", SqlDbType.VarChar, 1).Value = item.F0;
                    cmd.Parameters.Add("@F1", SqlDbType.VarChar, 1).Value = item.F1;

                    #region [20160916] HUYTO

                    cmd.Parameters.Add("@F2", SqlDbType.VarChar, 1).Value = item.F2;

                    #endregion

                    cmd.Parameters.Add("@TransactionStatus", SqlDbType.Int, 1).Value = TransactionStatus;
                    cmd.Parameters.Add("@TicketID", SqlDbType.NVarChar, 20).Value    = item.TicketID;
                    cmd.Parameters.Add("@CheckInDate", SqlDbType.DateTime).Value     =
                        new DateTime(int.Parse(item.CheckInDate.Split('/')[2].Split(' ')[0]),
                                     int.Parse(item.CheckInDate.Split('/')[0]), int.Parse(item.CheckInDate.Split('/')[1]),
                                     int.Parse(item.CheckInDate.Split(' ')[1].Split(':')[0]),
                                     int.Parse(item.CheckInDate.Split(' ')[1].Split(':')[1]),
                                     int.Parse(item.CheckInDate.Split(' ')[1].Split(':')[2]));
                    cmd.Parameters.Add("@CommitDate", SqlDbType.DateTime).Value =
                        new DateTime(int.Parse(item.CommitDate.Split('/')[2].Split(' ')[0]),
                                     int.Parse(item.CommitDate.Split('/')[0]), int.Parse(item.CommitDate.Split('/')[1]),
                                     int.Parse(item.CommitDate.Split(' ')[1].Split(':')[0]),
                                     int.Parse(item.CommitDate.Split(' ')[1].Split(':')[1]),
                                     int.Parse(item.CommitDate.Split(' ')[1].Split(':')[2]));
                    cmd.Parameters.Add("@ETCStatus", SqlDbType.Char, 1).Value = item.ETCStatus;

                    //cmd.Parameters.Add("@SequenceID", SqlDbType.BigInt).Value = item.SequenceID;

                    cmd.Parameters.Add("@TID", SqlDbType.VarChar, 48).Value = "";

                    //else
                    //{
                    //    cmd.Parameters.Add("@SequenceID", SqlDbType.BigInt).Value = 0;
                    //}
                    // Thuc thi stored
                    int numRows = ExecuteNonQuery(cmd);

                    // Kiem tra ket qua
                    if (numRows < 1)
                    {
                        res = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                TKUtils.WriteLogFile(GetType() + "." + MethodBase.GetCurrentMethod().Name,
                                     ex.ToString());
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Connection.Close();
                    cmd.Dispose();
                }
                cmd = null;
            }
            return(res);
        }