示例#1
0
        private void btnLogin_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            try
            {
                //调用业务规则
                ArrayList lstPurview = null;
                ArrayList lstPage    = null;
                Oper      operLogin  = OperFacade.OperLogin(tbxAdminUser.Text.Trim(), tbxAdminPass.Text, Request.UserHostAddress, Request.Browser.Browser, out lstPurview, out lstPage);

                //将用户信息保存到Session变量
                Session[ConstValue.LOGIN_USER_SESSION] = operLogin;

                //将用户菜单权限保存到Session变量
                Session[ConstValue.LOGIN_USER_PURVIEW_SESSION] = lstPurview;
                //将用户页面权限保存到Session变量
                Session[ConstValue.LOGIN_USER_PAGE_SESSION] = lstPage;


                tblInput.Visible = false;                  // 置用户信息输入框为不可见
                //tblAvi.Visible = true;     // 置登录成功动画为可见,在登录成功动画的最后一帧将页面导航至Main.aspx
                this.Response.Redirect("main.aspx");
            }
            catch (BusinessException be)
            {
                string strScript = "<script language='javascript'>";
                strScript += "alert('" + be.Message + "');";
                strScript += "</script>";

                Response.Write(strScript);
            }
        }
示例#2
0
        private static void LogIn(string strOperName, string strPWD, string strL6Name, string strL8Name)
        {
            if (!Membership.ValidateUser(strOperName, strPWD))
            {
                throw new BusinessException("登录错误", "操作员或密码输入错误");
            }


            SecurityManage security = new SecurityManage();
            Oper           oper     = security.GetOperByName(strOperName);
            Dept           dept     = new Dept();

            dept.cnnDeptID    = 0;
            dept.cnnDiscount  = 0;
            dept.cnvcDeptName = "云南人才中心";
            if (oper.cnnDeptID != 0)
            {
                dept = security.GetDeptById(oper.cnnDeptID);
            }

            List <string> lFunc       = security.GetFuncById(oper.cnnOperID, oper.cnnDeptID, constApp.strCardType, strL6Name, strL8Name);
            List <string> lAllFunc    = security.GetAllFunc(constApp.strCardType, strL6Name, strL8Name);
            MyIdentity    myidentity  = new MyIdentity(oper, dept, Membership.Provider.Name);
            MyPrincipal   myprincipal = new MyPrincipal(myidentity, lFunc, lAllFunc);

            Thread.CurrentPrincipal = myprincipal;
            //AppDomain.CurrentDomain.SetThreadPrincipal(myprincipal);
            //return security;
        }
示例#3
0
        public AgregarModificarAlumnos()
        {
            InitializeComponent();

            cmbCurso.DataSource    = llenar.ObtenerCursos();
            cmbCurso.ValueMember   = "IdCurso";
            cmbCurso.DisplayMember = "CursoString";

            cmbTD.DataSource    = llenar.ObtenerDocumento();
            cmbTD.ValueMember   = "IdDocumento";
            cmbTD.DisplayMember = "DocumentoString";

            cmbEstado.DataSource    = llenar.ObtenerEstados(); //Pache
            cmbEstado.ValueMember   = "IdEstado";              //Pache
            cmbEstado.DisplayMember = "EstadoString";          //Pache

            cmbCiclo.DataSource    = llenar.ObtenerCiclos();
            cmbCiclo.DisplayMember = "CicloString";
            cmbCiclo.Text          = Oper.NombreArchivo(false, false, true);

            /*
             *  cmbCurso.SelectedIndex = -1;
             *  cmbTD.SelectedIndex = -1;
             *  cmbEstado.SelectedIndex = -1;
             *  cmbCiclo.SelectedIndex = -1;*/
            string fechamax = Convert.ToString("31-12-" + (Convert.ToInt32(dtpFecha.Value.Year) - 10));

            dtpFecha.MaxDate = Convert.ToDateTime(fechamax);
        }
        public static void FillTree(TreeView tv, bool haveOper)
        {
            DataTable dtOper = ReportQueryFacade.CommonQuery("select * from tbOper order by cnvcOpername");            //"OperFacade.GetAllOper();
            DataTable dtDept = ReportQueryFacade.CommonQuery("select * from tbDept order by cnvcDeptName");            //OperFacade.GetAllDept();

            //最高级部门
            TreeNode tnTop = new TreeNode();

            tnTop.ID   = "dept_00";
            tnTop.Type = "dept";
            tnTop.Text = CommonStatic.EnterpriseFullName();

            if (haveOper)
            {
                DataRow[] drOpers = dtOper.Select("cnvcDeptID=00");
                foreach (DataRow drOper in drOpers)
                {
                    Oper     oper   = new Oper(drOper);
                    TreeNode tnOper = OperNode(oper);
                    tnTop.Nodes.Add(tnOper);
                }
            }

            //一级部门
            DataRow[] drDepts = dtDept.Select("cnvcParentDeptID=00");
            foreach (DataRow drDept in drDepts)
            {
                Dept     dept   = new Dept(drDept);
                TreeNode tnDept = DeptNode(dept);
                FillNode(dtDept, dtOper, tnDept, dept.cnvcDeptID, haveOper);
                tnTop.Nodes.Add(tnDept);
            }
            tv.Nodes.Add(tnTop);
        }
        public static void FillNode(DataTable dtDept, DataTable dtOper, TreeNode tnParent, string strDeptID, bool haveOper)
        {
            if (haveOper)
            {
                DataRow[] drOpers = dtOper.Select("cnvcDeptID='" + strDeptID + "'");
                if (drOpers.Length > 0)
                {
                    foreach (DataRow drOper in drOpers)
                    {
                        Oper     oper   = new Oper(drOper);
                        TreeNode tnOper = OperNode(oper);
                        tnParent.Nodes.Add(tnOper);
                    }
                }
            }

            DataRow[] drDepts = dtDept.Select("cnvcParentDeptID='" + strDeptID + "'");
            if (drDepts.Length > 0)
            {
                foreach (DataRow drDept in drDepts)
                {
                    Dept     dept   = new Dept(drDept);
                    TreeNode tnDept = DeptNode(dept);
                    FillNode(dtDept, dtOper, tnDept, dept.cnvcDeptID, haveOper);
                    tnParent.Nodes.Add(tnDept);
                }
            }
        }
示例#6
0
 private void btnPlay_Click(object sender, EventArgs e)
 {
     try
     {
         curOper = Oper.AgainPlay;
         if (myPlay == null)
         {
             StartPlay();
         }
         else if (myPlay != null && myPlay.CurentState == PlayState.Run)
         {
             myPlay.Pause();
             SetButton(PlayState.Pause);
         }
         else if (myPlay != null && myPlay.CurentState == PlayState.Pause)
         {
             myPlay.ContinueRun();
             SetButton(PlayState.Run);
         }
     }
     catch
     {
         PlayCompleted(this, new EventArgs());
     }
 }
示例#7
0
        private void equalBtn_Click(object sender, EventArgs e)
        {
            switch (oper)
            {
            case (Oper.NON):

                break;

            case (Oper.SUM):
                textBox1.Text = (num1 + float.Parse(textBox1.Text)).ToString();
                inputMode     = false;
                break;

            case (Oper.MIN):
                textBox1.Text = (num1 - float.Parse(textBox1.Text)).ToString();
                inputMode     = false;
                break;

            case (Oper.DIV):
                textBox1.Text = (num1 / float.Parse(textBox1.Text)).ToString();
                inputMode     = false;
                break;

            case (Oper.MUT):
                textBox1.Text = (num1 * float.Parse(textBox1.Text)).ToString();
                inputMode     = false;
                break;
            }
            oper = Oper.NON;
            num1 = 0.0f;
        }
示例#8
0
    // Use this for initialization
    void Start()
    {
        oper = new Oper(this);
        Input.multiTouchEnabled = true;
        self       = GetComponent <Transform>();
        selfCamera = GetComponent <Camera>();
        kcpSocket  = GetComponent <KcpSocket>();

        kcpSocket.Init(ip, 8888, (Action <List <byte[]>, int>)((List <byte[]> a, int b) => {
            for (int i = 0; i < a.Count; i++)
            {
                // deal message( sendFormat="%f %f %f %d %d" -- frame pos.x pos.y dir.angle dir.speed )
                string msg        = System.Text.Encoding.Default.GetString(a[i]);
                string [] fposdir = msg.Split();
                float x           = float.Parse(fposdir[1]);
                float y           = float.Parse(fposdir[2]);

                double deltaX = x - self.position.x;
                double deltaY = y - self.position.y;
                double delta  = Math.Pow(deltaX * deltaX + deltaY * deltaY, 0.5);
                if (delta > 0.1)
                {
                    Debug.Log("delta=" + delta);
                }
                offsetX   = deltaX;
                offsetY   = deltaY;
                fakeFrame = 120;

                dir.angle     = int.Parse(fposdir[3]);
                dir.speed     = int.Parse(fposdir[4]);
                cube.rotation = Quaternion.Euler(0, 0, dir.angle);
            }
        }));
        kcpSocket.Connect(5000, onConnect);
    }
示例#9
0
        PirsEntry getEntry()
        {
            PirsEntry entry = new PirsEntry();

            entry.Filename = readString(0x27);
            //Console.WriteLine(entry.FileName.Length);
            if (!String.IsNullOrWhiteSpace(entry.Filename.Trim()))
            {
                entry.Flags = br.ReadByte();
                if (getBit(entry.Flags, 7))
                {
                    entry.Folder = true;
                }
                else
                {
                    entry.Folder = false;
                }
                br.ReadBytes(0x3);
                entry.Blocklen   = Oper.ByteArrayToInt(br.ReadBytes(0x3));
                entry.Cluster    = br.ReadInt32() >> 8;
                entry.Parent     = (ushort)Convert.ToUInt32(Oper.ByteArrayToString(br.ReadBytes(2)), 16);
                entry.Size       = Oper.ByteArrayToInt(br.ReadBytes(0x4));
                entry.UpdateTime = dosDateTime(Oper.ByteArrayToInt(br.ReadBytes(0x4)));
                entry.AccessTime = dosDateTime(Oper.ByteArrayToInt(br.ReadBytes(0x4)));
                long pos = br.BaseStream.Position;
                entry.CRC = getCRC(br, entry.Cluster, entry.Size);
                br.BaseStream.Seek(pos, SeekOrigin.Begin);
            }
            return(entry);
        }
示例#10
0
        int DumpGFCU(byte[] data, int startaddr)
        {
            int i = 0;

            for (; i < GFCU_ENTS_MAXCNT; i++)
            {
                int    pos   = startaddr + i * GFCU_EN_SIZE;
                byte[] entry = Oper.returnportion(data, pos, GFCU_EN_SIZE);

                int eof = ReadUInt32_LE(entry, GFCU_EN_EOF_START);
                if (eof == GFCU_EN_EOF_MAGIC)
                {
                    return(i - 1);
                }

                string fn  = Oper.ByteArrayToString_v2(entry, GFCU_EN_FN_START, GFCU_EN_FN_LENGTH);
                int    sz  = ReadUInt32_LE(entry, GFCU_EN_SIZE_START);
                int    blk = ReadUInt32_LE(entry, GFCU_EN_BLOCK_START);
                int    un  = ReadUInt32_LE(entry, GFCU_EN_UNKNOWN_START);

                GFCU gfcu = new GFCU(pos, fn, sz, blk, un);
                gfcu_arr.Add(gfcu);
            }
            return(i - 1);
        }
        private BillOfMaterials GetBOM()
        {
            Oper            curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper;
            BillOfMaterials _bom    = new BillOfMaterials();

            _bom.SetOriginalValue();
            _bom.cnvcBillNo          = txtBillNo.Text.Trim();
            _bom.cnvcContractNo      = ddlContractNo.SelectedValue;
            _bom.cnvcDeliveryCompany = ddlDeliveryCompany.SelectedValue;
            _bom.cnvcProvideCompany  = txtProvideCompany.Text.Trim();
            _bom.cnvcGoodsName       = ddlGoodsName.SelectedItem.Text;
            _bom.cnvcGoodsType       = ddlGoodsType.SelectedValue;
            _bom.cnvcUnit            = "KG";
            _bom.cnnReceiveCount     = Convert.ToDecimal(txtReceiveCount.Text.Trim());
            _bom.cnnCount            = Convert.ToDecimal(txtCount.Text.Trim());
            _bom.cnvcDeliveryMan     = txtDeliveryMan.Text.Trim();
            _bom.cndDeliveryDate     = Convert.ToDateTime(txtDeliveryDate.Text);
            _bom.cndProvideBeginDate = Convert.ToDateTime(txtProvideBeginDate.Text);
            _bom.cndProvideEndDate   = Convert.ToDateTime(txtProvideEndDate.Text);
            _bom.cndProvideMan       = txtProvideMan.Text.Trim();
            _bom.cnvcSignerCompany   = txtSignerCompany.Text.Trim();
            _bom.cnvcSigner          = txtSigner.Text.Trim();
            _bom.cndTimeOfValidity   = Convert.ToDateTime(txtProvideEndDate.Text);
            _bom.cnvcOperName        = curOper.cnvcOperName;
            _bom.cnnSpecialUnitPrice = Convert.ToDecimal(txtSpecialUnitPrice.Text.Trim());
            _bom.cnnSpecialFee       = Convert.ToDecimal(txtSpecialFee.Text.Trim());
            _bom.cnvcDeptID          = this.txtDeptID.Text;  //SysInitial.LocalDeptID;
            return(_bom);
        }
示例#12
0
        int DumpSFBX(string fn)
        {
            int sfbxaddr = 0, sfbxsize;

            for (int i = 0; i < SFBX_START.Length; i++)
            {
                byte[] sfbx_magic = ReadFile(fn, SFBX_START[i], SFBX_MAGIC.Length);
                if (CheckMagic(sfbx_magic, SFBX_MAGIC_START, SFBX_MAGIC))
                {
                    sfbxaddr = SFBX_START[i];
                    break;
                }
                if (i == SFBX_START.Length - 1)
                {
                    Console.WriteLine("SFBX data wasn't found. Scanning for it!");
                    sfbxaddr = ScanForSFBX(fn);
                    break;
                }
            }
            sfbxsize = GetSizeSFBX(fn, sfbxaddr);
            sfbxaddr = sfbxaddr + SFBX_ENTS_START; // Don't want the header

            if (sfbxsize == 0)
            {
                Console.WriteLine("Size of SFBX wasn't found in Adresstable");
                return(0);
            }

            int sfbx_ents_size   = sfbxsize - SFBX_BLOB_SIZE - SFBX_ENTS_START;
            int sfbx_ents_maxcnt = sfbx_ents_size / SFBX_EN_SIZE;
            int j = 0;

            //Read adresses in array
            for (; j < sfbx_ents_maxcnt; j++)
            {
                int    total_pos = sfbxaddr + j * SFBX_EN_SIZE;
                byte[] entry     = ReadFile(fn, total_pos, SFBX_EN_SIZE);

                int lba = ReadUInt32_LE(entry, SFBX_EN_LBA_START);
                int sz  = ReadUInt32_LE(entry, SFBX_EN_SZ_START);

                int fileaddr = lba * LOG_BLOCK_SZ;

                // msft-xvd magic doesnt start at 0x0!
                byte[] xvd = ReadFile(fn, fileaddr + XVD_MAGIC_START, XVD_MAGIC.Length);
                byte[] magic;
                if (Oper.ByteArrayCompare(xvd, XVD_MAGIC))
                {
                    magic = Oper.StringToByteArray_v3("XVD");
                }
                else
                {
                    magic = ReadFile(fn, fileaddr, MAGIC_SIZE);
                }

                SFBX s = new SFBX(total_pos, lba, sz, magic);
                sfbx_arr.Add(s);
            }
            return(j - 1);
        }
示例#13
0
        public int UpdatePwd(Oper oper, BusiLog busiLog)
        {
            //SqlConnection conn = ConnectionPool.BorrowConnection();
            int iRet = 0;

            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    iRet = OperAccess.UpdatePwd(trans, oper);
                    BusiLogAccess.AddBusiLog(trans, busiLog);
                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
            return(iRet);
        }
示例#14
0
 private void ultraButton3_Click(object sender, System.EventArgs e)
 {
     //删除
     try
     {
         Oper opers = new Oper();
         opers.cnnOperID    = int.Parse(txtOperName3.Tag.ToString());
         opers.cnvcOperName = txtOperName.Text;
         if (cmbDept3.Items.Count > 0)
         {
             if (cmbDept3.SelectedIndex >= 0)
             {
                 opers.cnnDeptID = int.Parse(cmbDept3.SelectedItem.DataValue.ToString());
             }
         }
         SecurityManage secruty = new SecurityManage();
         secruty.DeleteOper(opers);
         MessageBox.Show(this, "操作员修改成功!", "操作员管理", MessageBoxButtons.OK, MessageBoxIcon.Information);
         BindDept();
     }
     catch (BusinessException bex)
     {
         MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#15
0
 private void btnAddOper_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (txtOperName.Text == "admin")
         {
             throw new BusinessException("操作员管理", "操作员添加错误!");
         }
         Oper opers = new Oper();
         opers.cnvcOperName = txtOperName.Text;
         opers.cnvcPwd      = DataSecurity.Encrypt(txtPwd.Text);
         opers.cnnDeptID    = int.Parse(cmbDept.SelectedItem.DataValue.ToString());
         SecurityManage security = new SecurityManage();
         security.AddOper(opers);
         MessageBox.Show(this, "操作员添加成功!", "操作员管理", MessageBoxButtons.OK, MessageBoxIcon.Information);
         BindDept();
     }
     catch (BusinessException bex)
     {
         MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#16
0
 private void ClearBtn_Click(object sender, EventArgs e)
 {
     textBox1.Text = "0";
     textBox2.Clear();
     num1 = 0.0f;
     Oper oper = Oper.NON;
 }
        /// <summary>
        /// Checks a user's authorization against a given rule
        /// </summary>
        /// <param name="principal">The user to authorize</param>
        /// <param name="context">The name of the rule to check</param>
        /// <returns>boolean indicating whether the user is authorized</returns>
        public override bool Authorize(System.Security.Principal.IPrincipal principal, string context)
        {
            if (principal == null)
            {
                throw new ArgumentNullException("principal");
            }
            if (context == null || context.Length == 0)
            {
                throw new ArgumentNullException("context");
            }

            //SecurityAuthorizationCheckEvent.Fire(principal.Identity.Name, context);
            InstrumentationProvider.FireAuthorizationCheckPerformed(principal.Identity.Name, context);

            DataTable dt = SqlHelper.ExecuteDataTable(CommandType.Text, "select * from tbOper where cnvcOperName='" + principal.Identity.Name + "'");

            if (dt.Rows.Count == 0)
            {
                return(false);
            }
            Oper   oper        = new Oper(dt);
            object objOperFunc = SqlHelper.ExecuteScalar(CommandType.Text, "select count(*) from tbOperFunc where cnnOperID=" + oper.cnnOperID + " and cnvcFuncCode='" + context + "'");
            object objDeptFunc = SqlHelper.ExecuteScalar(CommandType.Text, "select count(*) from tbDeptFunc where cnnDeptID=" + oper.cnnDeptID + " and cnvcFuncCode='" + context + "'");
            int    iOperFunc   = Convert.ToInt32(objOperFunc);
            int    iDeptFunc   = Convert.ToInt32(objDeptFunc);

            bool result = iOperFunc + iDeptFunc > 0 ? true : false;

            if (result == false)
            {
                //SecurityAuthorizationFailedEvent.Fire(principal.Identity.Name, context);
                InstrumentationProvider.FireAuthorizationCheckFailed(principal.Identity.Name, context);
            }
            return(result);
        }
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (!this.BOSValidate())
                {
                    return;
                }
                BillOfOutStorage bos = GetBOS();

                Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept;
                Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper;

                BusiLog busiLog = new BusiLog();
                busiLog.cnvcOperName = curOper.cnvcOperName;
                busiLog.cnvcDeptID   = curDept.cnvcDeptID;
                busiLog.cnvcDeptName = curDept.cnvcDeptName;

                ReportQueryFacade.UpdateBOS(bos, busiLog);
                this.Popup("调拨单修改成功");
            }
            catch (Exception ex)
            {
                this.Popup(ex.Message);
            }
        }
示例#19
0
        private void lstOperativos_DoubleClick(object sender, EventArgs e)
        {
            if (lstOperativos.SelectedIndex == -1)
            {
                return;
            }

            //trae los datos de la BD para mostrar en los textos
            vSQL = "SELECT * FROM Operativo " +
                   " WHERE LTRIM(RTRIM(Descripcion)) = '" + lstOperativos.GetItemText(lstOperativos.SelectedItem).Trim().ToUpper() + "'" +
                   " ORDER BY 2";
            //Usando DAPPER
            using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["CNN"].ConnectionString))
            {
                //si la conexion esta cerrada, la abre
                if (db.State == ConnectionState.Closed)
                {
                    db.Open();
                }

                //DAPPER retorna los datos en el objeto del tipo Oper
                //el metodo QueryFirst trae solo 1 registro
                cOper = db.QueryFirst <Oper>(vSQL);

                //llena los textos con los datos del query
                txtId.Text          = cOper.Id_Oper;
                txtDescrip.Text     = cOper.Descripcion;
                txtTel.Text         = cOper.Telefono;
                txtDirec.Text       = cOper.Direccion;
                txtJefe.Text        = "";          //esta variable no se encuentra en la BD
                txtObservacion.Text = cOper.Obs;
            }
        }
        public DataTable getAllOperNoSys(Oper opers)
        {
            DataTable dtOper = null;

            if (opers.cnnDeptID == 0)
            {
                dtOper = SqlHelper.ExecuteDataTable(CommandType.Text, "select * from tbOper where cnnDeptID <> 0");
            }
            else
            {
                DataTable dtManage = SqlHelper.ExecuteDataTable(CommandType.Text, "select * from tbDept where cnvcManager = '" + opers.cnvcOperName + "'");
                if (dtManage.Rows.Count != 1)
                {
                    dtOper = SqlHelper.ExecuteDataTable(CommandType.Text, "select * from tbOper where cnnDeptID = " + opers.cnnDeptID);
                }
                else
                {
                    Dept dept = new Dept(dtManage);
                    dtOper = SqlHelper.ExecuteDataTable(CommandType.Text, "select * from tbOper where cnnDeptID = " + dept.cnnDeptID.ToString());
                }
            }


            return(dtOper);
        }
        private BillOfOutStorage GetBOS()
        {
            Oper             curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper;
            BillOfOutStorage _bos    = new BillOfOutStorage();

            _bos.SetOriginalValue();
            _bos.cnvcBillNo                = txtBillNo.Text.Trim();
            _bos.cnvcProvideStroage        = txtProvideStroage.Text.Trim();
            _bos.cnvcDeliveryCompany       = ddlDeliveryCompany.SelectedItem.Text;
            _bos.cnvcMoveNo                = txtMoveNo.Text.Trim();
            _bos.cnvcBillOfMaterialsNo     = txtBillOfMaterialsNo.Text.Trim();
            _bos.cnvcTransportCompany      = txtTransportCompany.Text.Trim();
            _bos.cnvcTransportLiscenseTags = txtTransportLiscenseTags.Text.Trim();
            _bos.cndOutStorageDate         = Convert.ToDateTime(txtOutStorageDate.Text);
            _bos.cnvcGoodsName             = ddlGoodsName.SelectedItem.Text;
            _bos.cnvcGoodsType             = ddlGoodsType.SelectedValue;
            _bos.cnvcUnit            = "KG";
            _bos.cnnReceivableCount  = Convert.ToDecimal(txtReceivableCount.Text.Trim());
            _bos.cnnCount            = Convert.ToDecimal(txtCount.Text.Trim());
            _bos.cnvcComments        = txtComments.Text.Trim();
            _bos.cnvcStorageIncharge = txtStorageIncharge.Text.Trim();
            _bos.cnvcDeliveryMan     = txtDeliveryMan.Text.Trim();
            _bos.cnvcLister          = txtLister.Text.Trim();
            _bos.cnvcOperName        = curOper.cnvcOperName;
            _bos.cnvcDeptID          = this.txtDeptID.Text;
            _bos.cnvcDeliveryDeptID  = ddlDeliveryCompany.SelectedValue;
            return(_bos);
        }
        public void ModifyPwd(Oper opers)
        {
            try
            {
                conn  = ConnectionPool.BorrowConnection();
                trans = conn.BeginTransaction();
                SqlHelper.ExecuteNonQuery(trans, CommandType.Text, "update tbOper set cnvcPwd = '" + opers.cnvcPwd + "' where cnvcOperName = '" + opers.cnvcOperName + "'");

                trans.Commit();
            }
            catch (BusinessException bex)             //业务异常
            {
                //LogAdapter.WriteBusinessException(bex);
                trans.Rollback();
                throw new BusinessException(bex.Type, bex.Message);
            }
            catch (SqlException sex)               //数据库异常
            {
                //事务回滚
                trans.Rollback();
                //LogAdapter.WriteDatabaseException(sex);
                throw new BusinessException("数据库异常", sex.Message);
            }
            catch (Exception ex)                         //其他异常
            {
                //事务回滚
                trans.Rollback();
                //LogAdapter.WriteFeaturesException(ex);
                throw new BusinessException("其它异常", ex.Message);
            }
            finally
            {
                ConnectionPool.ReturnConnection(conn);
            }
        }
        public void DeleteOper(Oper opers)
        {
            try
            {
                conn  = ConnectionPool.BorrowConnection();
                trans = conn.BeginTransaction();
                EntityMapping.Delete(opers, trans);

                trans.Commit();
            }
            catch (BusinessException bex)             //业务异常
            {
                //LogAdapter.WriteBusinessException(bex);
                trans.Rollback();
                throw new BusinessException(bex.Type, bex.Message);
            }
            catch (SqlException sex)               //数据库异常
            {
                //事务回滚
                trans.Rollback();
                //LogAdapter.WriteDatabaseException(sex);
                throw new BusinessException("数据库异常", sex.Message);
            }
            catch (Exception ex)                         //其他异常
            {
                //事务回滚
                trans.Rollback();
                //LogAdapter.WriteFeaturesException(ex);
                throw new BusinessException("其它异常", ex.Message);
            }
            finally
            {
                ConnectionPool.ReturnConnection(conn);
            }
        }
示例#24
0
        protected override void Seed(DocTracker.DAL.MainContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data.

            var docs = new List <Doc>();
            var doc  = new Doc
            {
                Title       = "测试公文",
                Copies      = 15,
                DocNumber   = "测试发[2018]1号",
                ReceiveDate = DateTime.Now,
                Remark      = "这里市备注",
                Scope       = "测试组,政府,区委,政协",
                SecretLv    = SecretLevel.NormalSecret, //秘密
                SendDate    = DateTime.Now,
                YearNumber  = 2018,
                Opers       = new List <Oper>()
            };
            var oper = new Oper
            {
                DocID = 1,
                Name  = "操作1"
            };

            doc.Opers.Add(oper);
            docs.Add(doc);
            docs.ForEach(d => context.Docs.AddOrUpdate(od => od.Title, d));
            context.SaveChanges();
        }
示例#25
0
 //private int _iDiscount;
 public MyIdentity(Oper oper, Dept dept, string authenticationType)
 {
     this._oper = oper;
     this._AuthenticationType = authenticationType;
     //this._iDiscount = discount;
     this._dept = dept;
 }
 public OperatorEditVM(Oper oper, List <Shift> shift, List <Certification> certification, OperatorCertifications operatorCertifications)
 {
     Oper                   = oper;
     Shift                  = shift;
     Certification          = certification;
     OperatorCertifications = operatorCertifications;
 }
示例#27
0
        private DeviceMode GetMode(string lpFileName)
        {
            lpFileName = "\\\\.\\" + lpFileName.ToUpper();
            int numBytesRead = 0;

            byte[]         bytes  = new byte[0x200];
            DeviceMode     mode   = DeviceMode.None;
            SafeFileHandle handle = CreateFile(lpFileName, 0x80000000, 1, IntPtr.Zero, 3, 0, IntPtr.Zero);

            if (handle.IsInvalid)
            {
                handle.Close();
                return(DeviceMode.None);
            }
            ReadFile(handle, bytes, 0x200, out numBytesRead, IntPtr.Zero);
            byte[] first = new byte[] { bytes[510], bytes[0x1ff] };

            if (first.SequenceEqual <byte>(XBOX_Signature))
            {
                mode = DeviceMode.Xbox;
            }
            else if (first.SequenceEqual <byte>(PC_Signature))
            {
                if (Oper.allsame(Oper.returnportion(bytes, 0, 440), 0x00))
                {
                    mode = DeviceMode.PC;
                }
            }
            handle.Close();
            return(mode);
        }
示例#28
0
        /// <summary>
        /// Opens a OpenFileDialog window and returns a DialogResult if blocking otherwise dialog.ok
        /// </summary>
        /// <param name="fbd">Reference to a OpenFileDialog</param>
        /// <param name="onfinish">If a delegate is passed, then it doesn't block.</param>
        /// <returns></returns>
        public static DialogResult OpenFileDialog(ref OpenFileDialog fbd, onDialogFinished onfinish = null)
        {
            if (!Directory.Exists(fbd.InitialDirectory))
            {
                if (Directory.Exists(Path.Combine(Environment.CurrentDirectory, fbd.InitialDirectory)))
                {
                    fbd.InitialDirectory = Path.Combine(Environment.CurrentDirectory, fbd.InitialDirectory);
                }
                else
                {
                    fbd.InitialDirectory = Environment.CurrentDirectory;
                }
            }
            DialogResult dr     = new DialogResult();
            Oper         o      = new Oper(ref fbd, ref dr);
            Thread       thread = new Thread(() => OpenFileDialog_DoWork(o));

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            if (onfinish != null)
            {
                return(DialogResult.OK);
            }
            while (!o._isFinished)
            {
                Thread.Sleep(100);
            }
            return(o._dr);
        }
        private bool CheckPassword(string username, string password, bool updateLastLoginActivityDate)
        {
            string   passwdFromDB;
            int      failedPasswordAttemptCount;
            bool     isPasswordCorrect;
            DateTime lastLoginDate, lastActivityDate;

            DataTable dt = SqlHelper.ExecuteDataTable(CommandType.Text, "select * from tbOper where cnvcOperName='" + username + "'");

            if (dt.Rows.Count == 0)
            {
                throw new BusinessException("操作员登录", "未找到操作员!");
            }
            Oper oper = new Oper(dt);

            GetPasswordWithFormat(oper, updateLastLoginActivityDate, out passwdFromDB, out failedPasswordAttemptCount,
                                  out lastLoginDate, out lastActivityDate);

            //string encodedPasswd = EncodePassword(password);

            isPasswordCorrect = UnEncodePassword(passwdFromDB).Equals(password);

            if (isPasswordCorrect)
            {
                return(true);
            }
            oper.FailedPasswordAttemptCount       = oper.FailedPasswordAttemptCount + 1;
            oper.FailedPasswordAttemptWindowStart = DateTime.Now;

            EntityMapping.Update(oper);
            return(isPasswordCorrect);
        }
示例#30
0
        private void Button1_Click(object sender, System.EventArgs e)
        {
            try
            {
                Oper oper = LoginFacade.IsUser(txtLoginID.Text, txtPwd.Text);
//				ArrayList list = Application["GLOBAL_USER_LIST"] as ArrayList;
//				if (list == null)
//  			{
//  				list = new ArrayList();
//  			}
//  			for (int i = 0; i < list.Count; i++)
//  			{
//  				if (txtLoginID.Text == (list[i] as string))
//  				{
//  					//厮将鞠村阻�戻幣危列佚連
//						throw new Exception("緩喘薩厮将鞠村");  
//  				}
//  			}
//  			list.Add(txtLoginID.Text);
//				Application["GLOBAL_USER_LIST"]  = list;
                Session[ConstApp.S_OPER] = oper;
                Response.Redirect("wfmMain.aspx", false);
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
示例#31
0
 /// <summary>
 /// Opens a "FileDialog" prompt window and returns the Dialog Result if blocking, otherwise DialogResult.OK.
 /// Call will block if a delegate isn't passed.
 /// </summary>
 /// <param name="fd">Reference of a FileDialog </param>
 /// <param name="onfinish">If a delegate is passed, then it doesn't block.</param>
 /// <returns></returns>
 public static DialogResult FileDialog(ref FileDialog fd, onDialogFinished onfinish = null)
 {
     DialogResult dr = new DialogResult();
     Oper o = new Oper(ref fd, ref dr) {_callback = onfinish};
     Thread thread = new Thread(() => FileDialog_DoWork(o));
     thread.SetApartmentState(ApartmentState.STA);
     thread.Start();
     if (onfinish != null)
         return DialogResult.OK;
     while (!o._isFinished)
         Thread.Sleep(100);
     return o._dr;
 }
        public void execute_ordered_test()
        {
            var mockPipelineDefinition = new Mock<IPipeDefinition>();
            var oper = new Oper((a, o) => (int)o * 2);
            mockPipelineDefinition.SetupGet(e => e.Closed).Returns(true);

            mockPipelineDefinition.SetupGet(e => e.Operations).Returns(new[] {oper});

            var item = new PipelineCompiler<int, int>(mockPipelineDefinition.Object);

            var f = item.Compile();

            Assert.That(f(null, 5), Is.EqualTo(10));
        }
示例#33
0
 /// <summary>
 /// Opens a OpenFileDialog window and returns a DialogResult if blocking otherwise dialog.ok
 /// </summary>
 /// <param name="fbd">Reference to a OpenFileDialog</param>
 /// <param name="onfinish">If a delegate is passed, then it doesn't block.</param>
 /// <returns></returns>
 public static DialogResult OpenFileDialog(ref OpenFileDialog fbd, onDialogFinished onfinish = null)
 {
     if (!Directory.Exists(fbd.InitialDirectory))
         {
         if (Directory.Exists(Path.Combine(Environment.CurrentDirectory, fbd.InitialDirectory)))
             fbd.InitialDirectory = Path.Combine(Environment.CurrentDirectory, fbd.InitialDirectory);
         else
             fbd.InitialDirectory = Environment.CurrentDirectory;
         }
     DialogResult dr = new DialogResult();
     Oper o = new Oper(ref fbd, ref dr);
     Thread thread = new Thread(() => OpenFileDialog_DoWork(o));
     thread.SetApartmentState(ApartmentState.STA);
     thread.Start();
     if (onfinish != null)
         return DialogResult.OK;
     while (!o._isFinished)
         Thread.Sleep(100);
     return o._dr;
 }