예제 #1
0
        private void GridBind()
        {
            DeptDetails_dgv.DataSource = null;
            try
            {
                DepartmentVo vo = new DepartmentVo
                {
                    DepartmentCode = DeptCode_txt.Text,
                    DepartmentName = DeptName_txt.Text
                };

                ValueObjectList <DepartmentVo> volist = (ValueObjectList <DepartmentVo>)DefaultCbmInvoker.Invoke(new GetDepartmentVCBCbm(), vo);
                if (volist.GetList() != null && volist.GetList().Count > 0)
                {
                    DeptDetails_dgv.AutoGenerateColumns = false;
                    BindingSource bindingsource = new BindingSource(volist.GetList(), null);
                    DeptDetails_dgv.DataSource = bindingsource;
                }
                else
                {
                    messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                }
                DeptDetails_dgv.ClearSelection();
                Update_btn.Enabled = false;
                Delete_btn.Enabled = false;
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }
        }
예제 #2
0
        private void BindUpdateCavityData()
        {
            int selectedrowindex = DeptDetails_dgv.SelectedCells[0].RowIndex;

            DepartmentVo vo = (DepartmentVo)DeptDetails_dgv.Rows[selectedrowindex].DataBoundItem;

            AddDepartmentForm addform = new AddDepartmentForm();

            addform.vo = vo;
            addform.ShowDialog();
            if (addform.IntSuccess > 0)
            {
                messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);

                GridBind();
            }
            else if (addform.IntSuccess == 0)
            {
                messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);
                GridBind();
            }
        }
예제 #3
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            DepartmentVo  inVo = (DepartmentVo)vo;
            StringBuilder sql  = new StringBuilder();

            sql.Append("insert into vcb_department(vcb_department_cd, vcb_department_name, registration_user_cd, registration_date_time, factory_cd) ");
            sql.Append("values(:vcb_department_cd,:vcb_department_name, :registration_user_cd,now(),:factory_cd)");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("vcb_department_cd", inVo.DepartmentCode);
            sqlParameter.AddParameterString("vcb_department_name", inVo.DepartmentName);

            sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode);
            sqlParameter.AddParameterString("registration_user_cd", inVo.RegistrationUserCode);
            //execute SQL

            DepartmentVo outVo = new DepartmentVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
예제 #4
0
        protected override void BtnAdd_Click(object sender, EventArgs e)
        {
            DepartmentVo depVo = new DepartmentVo();

            departmentVoList.Add(depVo);
            this.gridControl1.RefreshDataSource();
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            DepartmentVo  inVo = (DepartmentVo)vo;
            StringBuilder sql  = new StringBuilder();

            sql.Append("update vcb_department set vcb_department_cd =:vcb_department_cd,vcb_department_name =:vcb_department_name");
            sql.Append(" where vcb_department_id =:vcb_department_id");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("vcb_department_cd", inVo.DepartmentCode);
            sqlParameter.AddParameterString("vcb_department_name", inVo.DepartmentName);
            sqlParameter.AddParameterInteger("vcb_department_id", inVo.DepartmentId);
            sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode);
            sqlParameter.AddParameterString("registration_user_cd", inVo.RegistrationUserCode);
            //execute SQL

            DepartmentVo outVo = new DepartmentVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
예제 #6
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            DepartmentVo  inVo = (DepartmentVo)vo;
            StringBuilder sql  = new StringBuilder();
            ValueObjectList <DepartmentVo> voList = new ValueObjectList <DepartmentVo>();
            DbCommandAdaptor sqlCommandAdapter    = base.GetDbCommandAdaptor(trxContext, string.Empty);
            DbParameterList  sqlParameter         = sqlCommandAdapter.CreateParameterList();

            sql.Append("select vcb_department_id, vcb_department_cd, vcb_department_name, registration_user_cd,registration_date_time,factory_cd from  vcb_department");
            sql.Append(" Where 1=1 ");
            if (!String.IsNullOrEmpty(inVo.FactoryCode))
            {
                sql.Append(" and factory_cd = :factory_cd ");
                sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode);
            }
            if (inVo.DepartmentId > 0)
            {
                sql.Append(" and vcb_department_id = :vcb_department_id ");
                sqlParameter.AddParameterInteger("vcb_department_id", inVo.DepartmentId);
            }
            if (!string.IsNullOrEmpty(inVo.DepartmentCode))
            {
                sql.Append(" and vcb_department_cd = :vcb_department_cd ");
                sqlParameter.AddParameterString("vcb_department_cd", inVo.DepartmentCode);
            }
            if (!string.IsNullOrEmpty(inVo.DepartmentName))
            {
                sql.Append(" and vcb_department_name = :vcb_department_name ");
                sqlParameter.AddParameterString("vcb_department_name", inVo.DepartmentName);
            }

            //create command
            //DbCommandAdaptor
            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (dataReader.Read())
            {
                DepartmentVo outVo = new DepartmentVo
                {
                    DepartmentCode = dataReader["vcb_department_cd"].ToString(),
                    DepartmentId   = int.Parse(dataReader["vcb_department_id"].ToString()),
                    DepartmentName = dataReader["vcb_department_name"].ToString(),

                    RegistrationUserCode = dataReader["registration_user_cd"].ToString(),
                    RegistrationDateTime = DateTime.Parse(dataReader["registration_date_time"].ToString()),
                    FactoryCode          = dataReader["factory_cd"].ToString()
                };
                voList.add(outVo);
            }
            dataReader.Close();
            return(voList);
        }
예제 #7
0
        public void Update(UserDepartmentPB pb, bool resetState = true)
        {
            SupporterVo vo = null;

            //UserDepartmentPB pb = res.MyDepartments;
            switch (pb.DepartmentType)
            {
            //没奖励的时候也要会动!

            case DepartmentTypePB.Support:
                MainVo = new SupporterVo(pb);
                break;

            case DepartmentTypePB.Active:
                Active = new SupporterVo(pb);
                SetAniState(resetState?1:0, 0, 0, 0);    //resetState表示从挥手变成待机 pb.Awards.Count>0?1:resetState?0:2
                break;

            case DepartmentTypePB.Financial:
                Financial = new SupporterVo(pb);
                SetAniState(0, resetState?1:0, 0, 0);
                break;

            case DepartmentTypePB.Resource:
                Resource = new SupporterVo(pb);
                SetAniState(0, 0, resetState?1:0, 0);
                break;

            case DepartmentTypePB.Transmission:
                Transmission = new SupporterVo(pb);
                SetAniState(0, 0, 0, resetState?1:0);
                break;
            }


            DepartmentVo dpVo = new DepartmentVo();

            dpVo.UserDepartmentPb = pb;
            dpVo.RulePb           = MyDepartmentData.GetDepartmentRule(dpVo.UserDepartmentPb.DepartmentType, dpVo.UserDepartmentPb.Level);
            for (int i = 0; i < GlobalData.DepartmentData.MyDepartments.Count; i++)
            {
                if (GlobalData.DepartmentData.MyDepartments[i].UserDepartmentPb.DepartmentType == dpVo.UserDepartmentPb.DepartmentType)
                {
                    GlobalData.DepartmentData.MyDepartments[i] = dpVo;
                    break;
                }
            }
        }
예제 #8
0
        protected override void BtnDel_Click(object sender, EventArgs e)
        {
            DepartmentVo vo = (DepartmentVo)this.gridView1.GetRow(this.gridView1.FocusedRowHandle);

            if (vo == null)
            {
                return;
            }
            departmentVoList.Remove(vo);
            if (DeleteDao.DeleteByID(vo.Id, typeof(DepartmentVo)) > 0)
            {
                XtraMessageBox.Show("删除成功");
                RefreshDepartment();
            }
            this.gridControl1.RefreshDataSource();
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            DepartmentVo     inVo = (DepartmentVo)vo;
            StringBuilder    sql  = new StringBuilder();
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty);
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("delete from  vcb_department Where 1=1 ");
            if (!String.IsNullOrEmpty(inVo.FactoryCode))
            {
                sql.Append(" and factory_cd = :factory_cd ");
                sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode);
            }
            if (inVo.DepartmentId > 0)
            {
                sql.Append(" and vcb_department_id = :vcb_department_id ");
                sqlParameter.AddParameterInteger("vcb_department_id", inVo.DepartmentId);
            }
            if (!string.IsNullOrEmpty(inVo.DepartmentCode))
            {
                sql.Append(" and vcb_department_cd = :vcb_department_cd ");
                sqlParameter.AddParameterString("vcb_department_cd", inVo.DepartmentCode);
            }
            if (!string.IsNullOrEmpty(inVo.DepartmentName))
            {
                sql.Append(" and vcb_department_name = :vcb_department_name ");
                sqlParameter.AddParameterString("vcb_department_name", inVo.DepartmentName);
            }



            //create command
            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());


            //execute SQL

            DepartmentVo outVo = new DepartmentVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
예제 #10
0
        private void Delete_btn_Click(object sender, EventArgs e)
        {
            if (DeptDetails_dgv.SelectedRows.Count > 0)
            {
                int selectedrowindex = DeptDetails_dgv.SelectedCells[0].RowIndex;

                DepartmentVo vo = (DepartmentVo)DeptDetails_dgv.Rows[selectedrowindex].DataBoundItem;

                messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, vo.DepartmentCode);
                logger.Info(messageData);
                DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text);

                if (dialogResult == DialogResult.OK)
                {
                    try
                    {
                        DepartmentVo outVo = (DepartmentVo)DefaultCbmInvoker.Invoke(new DeleteDepartmentVCBCbm(), vo);

                        if (outVo.AffectedCount > 0)
                        {
                            messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null);
                            logger.Info(messageData);
                            popUpMessage.Information(messageData, Text);

                            GridBind();
                        }
                        else if (outVo.AffectedCount == 0)
                        {
                            messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                            logger.Info(messageData);
                            popUpMessage.Information(messageData, Text);
                            GridBind();
                        }
                    }
                    catch (Com.Nidec.Mes.Framework.ApplicationException exception)
                    {
                        popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                        logger.Error(exception.GetMessageData());
                    }
                }
            }
        }
예제 #11
0
        private bool checkdate()
        {
            if (DeptCode_txt.Text.Trim().Length == 0)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, DeptCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                DeptCode_txt.Focus();
                return(false);
            }
            if (DeptName_txt.Text.Trim().Length == 0)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, DeptName_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                DeptName_txt.Focus();
                return(false);
            }
            DeptCode_txt.Text = DeptCode_txt.Text.Trim();
            DeptName_txt.Text = DeptName_txt.Text.Trim();
            DepartmentVo outVo = new DepartmentVo(),
                         inVo  = new DepartmentVo {
                DepartmentId = vo.DepartmentId, DepartmentCode = DeptCode_txt.Text
            };

            try
            {
                outVo = (DepartmentVo)DefaultCbmInvoker.Invoke(new CheckDepartmentVCBCbm(), inVo);
                if (outVo.AffectedCount > 0)
                {
                    messageData = new MessageData("mmcc00006", Properties.Resources.mmcc00006, DeptCode_lbl.Text);
                    popUpMessage.Warning(messageData, Text);
                    DeptCode_txt.Focus();
                    return(false);
                }
            }
            catch (Com.Nidec.Mes.Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
                return(false);
            }
            return(true);
        }
예제 #12
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            DepartmentVo     inVo = (DepartmentVo)vo;
            StringBuilder    sql  = new StringBuilder();
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty);
            DbParameterList  sqlParameter      = sqlCommandAdapter.CreateParameterList();

            sql.Append("Select Count(*) as DepartmentCount ");
            sql.Append(" from  vcb_department");
            sql.Append(" Where 1=1 ");

            if (!String.IsNullOrEmpty(inVo.FactoryCode))
            {
                sql.Append(" and factory_cd = :factory_cd ");
                sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode);
            }
            if (!string.IsNullOrEmpty(inVo.DepartmentCode))
            {
                sql.Append(" and UPPER(vcb_department_cd) = UPPER(:vcb_department_cd) ");
                sqlParameter.AddParameterString("vcb_department_cd", inVo.DepartmentCode);
            }
            if (inVo.DepartmentId > 0)
            {
                sql.Append(" and vcb_department_id != :vcb_department_id "); ///?????
                sqlParameter.AddParameterInteger("vcb_department_id", inVo.DepartmentId);
            }


            sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //execute SQL
            IDataReader  dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);
            DepartmentVo outVo      = new DepartmentVo();

            while (dataReader.Read())
            {
                outVo.AffectedCount = Convert.ToInt32(dataReader["DepartmentCount"].ToString());
            }
            dataReader.Close();
            return(outVo);
        }
예제 #13
0
 private void Ok_btn_Click(object sender, EventArgs e)
 {
     if (checkdate())
     {
         DepartmentVo outvo = new DepartmentVo();
         DepartmentVo invo  = new DepartmentVo
         {
             DepartmentId         = vo.DepartmentId,
             DepartmentCode       = DeptCode_txt.Text,
             DepartmentName       = DeptName_txt.Text,
             FactoryCode          = UserData.GetUserData().FactoryCode,
             RegistrationUserCode = UserData.GetUserData().UserCode
         };
         try
         {
             if (invo.DepartmentId > 0)
             {
                 outvo = (DepartmentVo)DefaultCbmInvoker.Invoke(new UpdateDepartmentVCBCbm(), invo);
             }
             else
             {
                 outvo = (DepartmentVo)DefaultCbmInvoker.Invoke(new AddDepartmentVCBCbm(), invo);
             }
             {
                 messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DeptCode_lbl.Text + " : " + DeptCode_txt.Text);
                 logger.Info(messageData);
                 popUpMessage.Information(messageData, Text);
             }
         }
         catch (Framework.ApplicationException exception)
         {
             popUpMessage.ApplicationError(exception.GetMessageData(), Text);
             logger.Error(exception.GetMessageData());
             return;
         }
     }
 }