Exemple #1
0
 static void Main()
 {
     Permit perm1 = Permit.Create;
     Console.WriteLine(perm1.ToString());
     Permit perm = Permit.Create | Permit.Read;
     Console.WriteLine(perm.ToString());
     perm |= Permit.Delete;
     Console.WriteLine(perm.ToString());
 }
        /// <summary>
        ///     удаляет указынный пропуск
        /// </summary>
        /// <param name="permit">удаляемый документ</param>
        private void DeletePermit(Permit permit)
        {
            string message = EntryControl.Resources.Message.Question.Delete;

            if (MessageBox.Show(message, permit.ToString(), MessageBoxButtons.YesNo)
                == DialogResult.Yes)
            {
                bsPermitList.Remove(permit);
                permit.Delete();
                permit.Save(Database);
            }
        }
        private void ClosePermit()
        {
            PermitMoving moving1 = Permit.Close(EntryPoint, Database.ConnectedUser);

            moving1.Save(Database);


            string message = EntryControl.Resources.Doc.Permit.PermitClose;

            message = message.Replace("@movingTime", moving1.MovingTime.ToString("dd.MM.yyyy HH:mm"));
            MessageBox.Show(message, Permit.ToString());
        }
Exemple #4
0
        private void AddBindings()
        {
            AddBinding(tboxDocNumber, "DocNumber");
            AddBinding(pickDocDate, "DocDate");
            AddBinding(tboxPerson, "Person");
            AddBinding(tboxVehicleMark, "VehicleMark");
            AddBinding(tboxLicensePlate, "LicensePlate");
            AddBinding(tboxBaseDocument, "BaseDocument");
            AddBinding(tboxBaseDocNumber, "BaseDocNumber");
            AddBinding(pickBaseDocDate, "BaseDocDate");
            AddBinding(tboxComment, "Comment");

            bsItemList.DataSource = Document.GetItemList(Database);

            if (Document.PermitId != 0)
            {
                Permit permit = Permit.Load(Database, Document.PermitId);
                tboxPermit.Text = permit.ToString();

                btnFindPermit.Text = permit.ToString();
            }
        }
 private void CheckClose()
 {
     if (Permit.IsMultiEntry)
     {
         if (MessageBox.Show(EntryControl.Resources.Doc.Permit.PermitToClose, Permit.ToString(),
                             MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             ClosePermit();
         }
     }
     else
     {
         ClosePermit();
     }
 }
Exemple #6
0
        private void AddBindings()
        {
            if (PlanAppoint.IsUpdated)
            {
                timer.Start();
            }

            lblCargo.Text       = PlanAppoint.Cargo.ToString();
            lblVehicleMark.Text = PlanAppoint.Vehicle.ToString();
            lblDriver.Text      = PlanAppoint.DriverName + " (" + PlanAppoint.Contact + ")";
            lblCreation.Text    = PlanAppoint.CreationInfo;

            PlanAppoint.GetComment(Database);
            tboxComment.DataBindings.Add("Text", bsItem, "Comment");

            if (PlanAppoint.HasPermit)
            {
                Permit permit = PlanAppoint.LoadPermit(Database);
                lblPermit.Text = permit.ToString();

                switch (permit.PermitState.Id)
                {
                case 4:
                    lblPermit.Text += " (закрыт)";
                    break;

                case 3:
                    lblPermit.Text += " (заблокирован)";
                    break;

                case 2:
                    lblPermit.Text += " (постоянный)";
                    break;
                }

                lboxPermitMoving.DataSource = permit.GetMovingList(Database);
                lboxPointList.DataSource    = permit.GetAllowedPointList(Database);
            }
            else
            {
                lblPermit.Text = "не выдан";
            }
        }
        private void LoadPermit(int permitId)
        {
            Permit permit = Permit.Load(Database, permitId);

            tboxPermit.Text = permit.ToString();
        }
 private void MessagePermitIsClosed()
 {
     MessageBox.Show(EntryControl.Resources.Message.Error.PermitIsClosed, Permit.ToString());
 }
 private void PermitMovingForm_Shown(object sender, EventArgs e)
 {
     Text = Permit.ToString();
 }
Exemple #10
0
        public override bool Save()
        {
            try
            {
                using (SqlConnection connection = DbControl.GetOpenConnection())
                {
                    SqlCommand command = connection.CreateCommand();
                    command.Parameters.Add(new SqlParameter("@ceid", System.Data.SqlDbType.VarChar)).Value     = CEID.ToString();
                    command.Parameters.Add(new SqlParameter("@cst_id", System.Data.SqlDbType.VarChar)).Value   = CSTID.ToString();
                    command.Parameters.Add(new SqlParameter("@lot_code", System.Data.SqlDbType.VarChar)).Value = LotCode.ToString();


                    command.Parameters.Add(new SqlParameter("@lot_id", System.Data.SqlDbType.VarChar)).Value = LotID == null ? "" : LotID;


                    command.Parameters.Add(new SqlParameter("@cst_size", System.Data.SqlDbType.VarChar)).Value  = CSTSize == null ? "" : CSTSize.ToString();
                    command.Parameters.Add(new SqlParameter("@eng_code", System.Data.SqlDbType.VarChar)).Value  = EngCode == null ? "" : EngCode;
                    command.Parameters.Add(new SqlParameter("@gls_thick", System.Data.SqlDbType.VarChar)).Value = GLSThick == null ? "" : GLSThick.ToString();


                    command.Parameters.Add(new SqlParameter("@host_msg", System.Data.SqlDbType.VarChar)).Value    = HostMsg == null ? "" : HostMsg;
                    command.Parameters.Add(new SqlParameter("@inline_code", System.Data.SqlDbType.VarChar)).Value = InLineCode.ToString() + "";

                    command.Parameters.Add(new SqlParameter("@inno", System.Data.SqlDbType.VarChar)).Value  = InNo.ToString();
                    command.Parameters.Add(new SqlParameter("@outno", System.Data.SqlDbType.VarChar)).Value = OutNo.ToString();

                    command.Parameters.Add(new SqlParameter("@keyid", System.Data.SqlDbType.VarChar)).Value       = KeyID == null ? "" : KeyID;
                    command.Parameters.Add(new SqlParameter("@lot_command", System.Data.SqlDbType.VarChar)).Value = LotCommand == null ? "" : LotCommand;

                    command.Parameters.Add(new SqlParameter("@lot_judge", System.Data.SqlDbType.VarChar)).Value       = LotJudge == null ? "" : LotJudge;
                    command.Parameters.Add(new SqlParameter("@lot_start_time", System.Data.SqlDbType.DateTime)).Value = LotStartTime.ToString("yyyy-MM-dd HH:mm:ss.fff");

                    command.Parameters.Add(new SqlParameter("@lot_state", System.Data.SqlDbType.VarChar)).Value = LotState.ToString();
                    command.Parameters.Add(new SqlParameter("@mode_code", System.Data.SqlDbType.VarChar)).Value = ModeCode == null ? "" : ModeCode;
                    command.Parameters.Add(new SqlParameter("@part_num", System.Data.SqlDbType.VarChar)).Value  = PartNum == null ? "" : PartNum;

                    command.Parameters.Add(new SqlParameter("@permit", System.Data.SqlDbType.VarChar)).Value = Permit.ToString();


                    command.Parameters.Add(new SqlParameter("@port_id", System.Data.SqlDbType.VarChar)).Value = PortID == null ? "" : PortID;

                    command.Parameters.Add(new SqlParameter("@prc_id", System.Data.SqlDbType.VarChar)).Value     = PrcID == null ? "" : PrcID;
                    command.Parameters.Add(new SqlParameter("@prod_type", System.Data.SqlDbType.VarChar)).Value  = ProdType == null ? "" : ProdType;
                    command.Parameters.Add(new SqlParameter("@rcp", System.Data.SqlDbType.VarChar)).Value        = RCP == null ? "" : RCP;
                    command.Parameters.Add(new SqlParameter("@slot_count", System.Data.SqlDbType.VarChar)).Value = SlotCount.ToString();



                    command.Parameters.Add(new SqlParameter("@download_time", System.Data.SqlDbType.DateTime)).Value = DownloadTime.ToString("yyyy-MM-dd HH:mm:ss.fff");

                    command.CommandText = "update lot_data set " +
                                          "ceid=@ceid, cst_id=@cst_id, cst_size=@cst_size, eng_code=@eng_code, gls_thick=@gls_thick, host_msg=@host_msg, inline_code=@inline_code, inno=@inno, " +
                                          "outno=@outno, keyid=@keyid, lot_command=@lot_command, lot_id=@lot_id, lot_judge=@lot_judge, lot_start_time=@lot_start_time, lot_state=@lot_state, mode_code=@mode_code, part_num=part_num, permit=@permit, " +
                                          "port_id=@port_id, prc_id=@prc_id, prod_type=@prod_type, rcp=@rcp, slot_count=@slot_count, download_time=@download_time " +
                                          "where lot_code=@lot_code";
                    command.Connection = connection;
                    command.ExecuteNonQuery();
                }
                return(true);
            }
            catch (SqlException ex)
            {
                CLogManager.Instance.Log(new CExceptionLogFormat(Catagory.Error, "EMP", ex));
            }

            return(false);
        }
Exemple #11
0
        public override bool Add()
        {
            SqlDataReader reader = null;

            try
            {
                using (SqlConnection connection = DbControl.GetOpenConnection())
                {
                    SqlCommand readCommand = connection.CreateCommand();

                    readCommand.Parameters.Add(new SqlParameter("@lot_code", System.Data.SqlDbType.VarChar)).Value = LotCode.ToString();
                    readCommand.CommandText = "select * from lot_data where lot_code=@lot_code";
                    readCommand.Connection  = connection;
                    reader = readCommand.ExecuteReader();

                    if (reader.Read())
                    {
                        reader.Close();
                    }
                    else
                    {
                        reader.Close();

                        SqlCommand command = connection.CreateCommand();

                        //신규
                        command.Parameters.Add(new SqlParameter("@ceid", System.Data.SqlDbType.VarChar)).Value     = CEID.ToString();
                        command.Parameters.Add(new SqlParameter("@cst_id", System.Data.SqlDbType.VarChar)).Value   = CSTID.ToString() + "";
                        command.Parameters.Add(new SqlParameter("@lot_code", System.Data.SqlDbType.VarChar)).Value = LotCode.ToString();


                        command.Parameters.Add(new SqlParameter("@lot_id", System.Data.SqlDbType.VarChar)).Value = LotID == null ? "" : LotID;


                        command.Parameters.Add(new SqlParameter("@cst_size", System.Data.SqlDbType.VarChar)).Value  = CSTSize == null ? "" : CSTSize.ToString();
                        command.Parameters.Add(new SqlParameter("@eng_code", System.Data.SqlDbType.VarChar)).Value  = EngCode == null ? "" : EngCode;
                        command.Parameters.Add(new SqlParameter("@gls_thick", System.Data.SqlDbType.VarChar)).Value = GLSThick == null ? "" : GLSThick.ToString();


                        command.Parameters.Add(new SqlParameter("@host_msg", System.Data.SqlDbType.VarChar)).Value    = HostMsg == null ? "" : HostMsg;
                        command.Parameters.Add(new SqlParameter("@inline_code", System.Data.SqlDbType.VarChar)).Value = InLineCode.ToString() + "";

                        command.Parameters.Add(new SqlParameter("@inno", System.Data.SqlDbType.VarChar)).Value  = InNo.ToString();
                        command.Parameters.Add(new SqlParameter("@outno", System.Data.SqlDbType.VarChar)).Value = OutNo.ToString();

                        command.Parameters.Add(new SqlParameter("@keyid", System.Data.SqlDbType.VarChar)).Value       = KeyID == null ? "" : KeyID;
                        command.Parameters.Add(new SqlParameter("@lot_command", System.Data.SqlDbType.VarChar)).Value = LotCommand == null ? "" : LotCommand;

                        command.Parameters.Add(new SqlParameter("@lot_judge", System.Data.SqlDbType.VarChar)).Value       = LotJudge == null ? "" : LotJudge;
                        command.Parameters.Add(new SqlParameter("@lot_start_time", System.Data.SqlDbType.DateTime)).Value = LotStartTime.ToString("yyyy-MM-dd HH:mm:ss.fff");

                        command.Parameters.Add(new SqlParameter("@lot_state", System.Data.SqlDbType.VarChar)).Value = LotState.ToString();
                        command.Parameters.Add(new SqlParameter("@mode_code", System.Data.SqlDbType.VarChar)).Value = ModeCode == null ? "" : ModeCode;
                        command.Parameters.Add(new SqlParameter("@part_num", System.Data.SqlDbType.VarChar)).Value  = PartNum == null ? "" : PartNum;

                        command.Parameters.Add(new SqlParameter("@permit", System.Data.SqlDbType.VarChar)).Value = Permit.ToString();


                        command.Parameters.Add(new SqlParameter("@port_id", System.Data.SqlDbType.VarChar)).Value = PortID == null ? "" : PortID;

                        command.Parameters.Add(new SqlParameter("@prc_id", System.Data.SqlDbType.VarChar)).Value     = PrcID == null ? "" : PrcID;
                        command.Parameters.Add(new SqlParameter("@prod_type", System.Data.SqlDbType.VarChar)).Value  = ProdType == null ? "" : ProdType;
                        command.Parameters.Add(new SqlParameter("@rcp", System.Data.SqlDbType.VarChar)).Value        = RCP == null ? "" : RCP;
                        command.Parameters.Add(new SqlParameter("@slot_count", System.Data.SqlDbType.VarChar)).Value = SlotCount.ToString();



                        command.Parameters.Add(new SqlParameter("@download_time", System.Data.SqlDbType.DateTime)).Value = DownloadTime.ToString("yyyy-MM-dd HH:mm:ss.fff");


                        command.Connection = connection;

                        command.CommandText = "insert into lot_data " +
                                              "(lot_code, ceid, cst_id, cst_size, eng_code, gls_thick, host_msg, inline_code, inno, outno, keyid, lot_command, lot_id, lot_judge, lot_state, mode_code, part_num, permit, port_id, prc_id, prod_type, rcp, slot_count, download_time) " +
                                              "values (@lot_code, @ceid, @cst_id, @cst_size, @eng_code, @gls_thick, @host_msg, @inline_code, @inno, @outno, @keyid, @lot_command, @lot_id, @lot_judge, @lot_state, @mode_code, @part_num, @permit, @port_id, @prc_id, @prod_type, @rcp, @slot_count, @download_time)";
                        command.ExecuteNonQuery();

                        return(true);
                    }
                }
            }
            catch (SqlException ex)
            {
                CLogManager.Instance.Log(new CExceptionLogFormat(Catagory.Error, "EMP", ex));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return(false);
        }