Пример #1
0
 // Update is called once per frame
 void Update()
 {
     if (Mathf.Abs(targetAngle - angle) < 0.01f)
     {
         return;
     }
     else if (Mathf.Abs(targetAngle - angle) > accelSection)
     {
         if (targetAngle > angle)
         {
             angle += maxRotateSpeed * Time.deltaTime;
         }
         else
         {
             angle -= maxRotateSpeed * Time.deltaTime;
         }
     }
     else
     {
         float rotateSpeed = Mathf.Lerp(minRotateSpeed, maxRotateSpeed, Mathf.Abs(targetAngle - angle) / accelSection);
         if (targetAngle > angle)
         {
             angle += rotateSpeed * Time.deltaTime;
         }
         else
         {
             angle -= rotateSpeed * Time.deltaTime;
         }
     }
     transform.localPosition = Publics.CirclePos(radius, angle);
     Display();
 }
Пример #2
0
 public void SetButton(float _radius, float _angle, float _border, int _menuSize)
 {
     radius = _radius;
     angle = _angle;
     border = _border;
     menuSize = _menuSize;
     transform.localPosition = Publics.CirclePos(radius, angle);
     targetAngle = angle;
     Display();
 }
Пример #3
0
        public static void CreateUpdateDeleteSysOnline(SysOnline item, DataProviderAction action)
        {
            if (item == null)
            {
                return;
            }

            SqlConnection conn = DBUtils.GetConnection();
            SqlCommand    cmd  = DBUtils.GetCommand();

            try
            {
                cmd.Transaction = conn.BeginTransaction();

                ArrayList paras = new ArrayList();

                paras.Add(DBUtils.MakeInParam("@Man_ID", SqlDbType.NVarChar, 6, item.ManID));
                paras.Add(DBUtils.MakeInParam("@Login_Date", SqlDbType.DateTime, Publics.GetDataDateTime(item.LoginDate)));
                paras.Add(DBUtils.MakeInParam("@Online_Date", SqlDbType.DateTime, Publics.GetDataDateTime(item.OnlineDate)));
                paras.Add(DBUtils.MakeInParam("@Menu_Code", SqlDbType.NVarChar, 4, item.MenuCode));
                paras.Add(DBUtils.MakeInParam("@Reg_ID", SqlDbType.SmallInt, item.RegID));
                paras.Add(DBUtils.MakeInParam("@Action", SqlDbType.Int, action));

                DBUtils.ExecuteNonQuery(conn, cmd, CommandType.StoredProcedure, PublicConsts.DatabaseOwner + ".P_CreateUpdateDelete_SysOnline", paras);

                if (action != DataProviderAction.Update)
                {
                    SysLog sl = new SysLog();
                    sl.LogDate   = DateTime.Now;
                    sl.ManID     = item.ManID;
                    sl.LogAction = (short)LoginAction.Info;
                    if (action == DataProviderAction.Create)
                    {
                        sl.LogContent = "登录系统";
                    }
                    else
                    {
                        sl.LogContent = "退出系统";
                    }

                    SqlBaseProvider.CreateUpdateDeleteSysLog(sl, DataProviderAction.Create);
                }

                cmd.Transaction.Commit();
            }
            catch
            {
                cmd.Transaction.Rollback();
                throw;
            }
            finally
            {
                DBUtils.SetDispose(conn, cmd);
            }
        }
Пример #4
0
        public static void SaveSysMan(SysMan item, DataProviderAction action)
        {
            if (item == null)
            {
                return;
            }

            SqlConnection conn = DBUtils.GetConnection();
            SqlCommand    cmd  = DBUtils.GetCommand();

            try
            {
                cmd.Transaction = conn.BeginTransaction();

                ArrayList paras = new ArrayList();

                paras.Add(DBUtils.MakeInParam("@Man_ID", SqlDbType.NVarChar, 6, item.ManID));
                paras.Add(DBUtils.MakeInParam("@Man_Name", SqlDbType.NVarChar, 10, item.ManName));
                paras.Add(DBUtils.MakeInParam("@Co_ID", SqlDbType.NVarChar, 4, item.CoID));
                paras.Add(DBUtils.MakeInParam("@Dept_ID", SqlDbType.NVarChar, 8, item.DeptID));
                paras.Add(DBUtils.MakeInParam("@Man_Type", SqlDbType.SmallInt, item.ManType));
                paras.Add(DBUtils.MakeInParam("@Crt_Date", SqlDbType.DateTime, item.CrtDate));
                paras.Add(DBUtils.MakeInParam("@Crt_Oper", SqlDbType.NVarChar, 6, item.CrtOper));
                paras.Add(DBUtils.MakeInParam("@Man_Tele", SqlDbType.NVarChar, 30, item.ManTele));
                paras.Add(DBUtils.MakeInParam("@Man_EMail", SqlDbType.NVarChar, 32, item.ManEMail));
                paras.Add(DBUtils.MakeInParam("@Man_Date", SqlDbType.DateTime, Publics.GetDataDateTime(item.ManDate)));
                paras.Add(DBUtils.MakeInParam("@Man_Level", SqlDbType.SmallInt, item.ManLevel));
                paras.Add(DBUtils.MakeInParam("@Man_Title", SqlDbType.SmallInt, item.ManTitle));
                paras.Add(DBUtils.MakeInParam("@Man_Sex", SqlDbType.SmallInt, item.ManSex));
                paras.Add(DBUtils.MakeInParam("@Man_Status", SqlDbType.SmallInt, item.ManStatus));
                paras.Add(DBUtils.MakeInParam("@Oper_Password", SqlDbType.NVarChar, 50, item.OperPassword));
                paras.Add(DBUtils.MakeInParam("@Oper_Serial", SqlDbType.Int, item.OperSerial));
                paras.Add(DBUtils.MakeInParam("@Work_Date", SqlDbType.NVarChar, 8, item.WorkDate));
                paras.Add(DBUtils.MakeInParam("@Auth_Bound", SqlDbType.SmallInt, item.AuthBound));
                paras.Add(DBUtils.MakeInParam("@Is_Admin", SqlDbType.Bit, item.IsAdmin));
                paras.Add(DBUtils.MakeInParam("@Remark", SqlDbType.NVarChar, 20, item.Remark));
                paras.Add(DBUtils.MakeInParam("@Pre_Work_Date", SqlDbType.NVarChar, 8, item.WorkDate));
                paras.Add(DBUtils.MakeInParam("@Action", SqlDbType.Int, action));

                DBUtils.ExecuteNonQuery(conn, cmd, CommandType.StoredProcedure, PublicConsts.DatabaseOwner + ".P_Save_SysMan", paras);

                cmd.Transaction.Commit();
            }
            catch
            {
                cmd.Transaction.Rollback();
                throw;
            }
            finally
            {
                DBUtils.SetDispose(conn, cmd);
            }
        }
Пример #5
0
        protected bool OnBeforeSave()
        {
            if (String.IsNullOrEmpty(txtDeptID.Text))
            {
                Global.ShowSysInfo("部门编号不能为空!");
                return(false);
            }

            if (String.IsNullOrEmpty(txtDeptName.Text))
            {
                Global.ShowSysInfo("部门名称不能为空!");
                return(false);
            }

            if (ddlDeptStatus.SelectedValue.ToString() == DropAddFlag.Select.ToString())
            {
                Global.ShowSysInfo("请选择部门状态!");
                return(false);
            }

            if (ddlDeptLevel.SelectedValue.ToString() == DropAddFlag.Select.ToString())
            {
                Global.ShowSysInfo("请选择部门级别!");
                return(false);
            }

            if (ddlCoID.SelectedValue.ToString() == DropAddFlag.Select.ToString())
            {
                Global.ShowSysInfo("请选择所属公司!");
                return(false);
            }

            if (ddlDeptType.SelectedValue.ToString() == DropAddFlag.Select.ToString())
            {
                Global.ShowSysInfo("请选择部门类型!");
                return(false);
            }

            if (!Publics.CheckInt16(txtSortOrder.Text))
            {
                Global.ShowSysInfo("排序序号不能为空,且必须为数字!");
                return(false);
            }

            if (String.IsNullOrEmpty(txtDeptShort.Text))
            {
                Global.ShowSysInfo("部门简称不能为空!");
                return(false);
            }

            return(true);
        }
Пример #6
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(ectDept.SelectValue.ToString()))
            {
                MessageBox.Show("您没有选择需要注册的部门,请重新选择!");
                return;
            }

            try
            {
                SysRegister rg = SqlBaseProvider.GetSysRegister(Publics.GetRegisterNumber(Program.CpuInfo));

                if (String.IsNullOrEmpty(rg.DeptID))
                {
                    rg.DeptID    = ectDept.SelectValue.ToString();
                    rg.CpuCode   = Program.CpuInfo;
                    rg.CrtDate   = DateTime.Now;
                    rg.RegNumber = Publics.GetRegisterNumber(Program.CpuInfo);
                    rg.RegCode   = rg.RegNumber;

                    SqlBaseProvider.SaveSysRegister(rg, DataProviderAction.Create);

                    if (rg.RegID > 0)
                    {
                        MessageBox.Show("该终端已经在系统里注册成功!");
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        throw new Exception("注册时数据库发生错误!");
                    }
                }
                else
                {
                    if (rg.DeptID != ectDept.SelectValue.ToString())
                    {
                        MessageBox.Show("该终端已经在系统里被其它部门注册完成,不能被重复注册!");
                        return;
                    }
                    else
                    {
                        MessageBox.Show("该终端已经在系统里注册完成,不需要再次注册,确认后直接进入系统!");
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("注册时产生错误,请与系统管理员联系!" + ex.Message);
                return;
            }
        }
Пример #7
0
 void Display()
 {
     for (int idx = 0; idx < buttonCount; idx++)
     {
         buttons[idx].localPosition = Publics.CirclePos(UIRadius, scrollSpeed * buttonPosition[idx]);
         int order = menuSize - Mathf.Abs(buttonPosition[idx]);
         order = Mathf.Clamp(order, 0, menuSize);
         buttons[idx].GetComponent <Canvas>().sortingOrder = order;
         //buttons[idx].GetComponent<CanvasRenderer>().SetAlpha((float)order / menuSize);
         var buttonRenderers = buttons[idx].GetComponentsInChildren <CanvasRenderer>();
         foreach (CanvasRenderer renderer in buttonRenderers)
         {
             renderer.SetAlpha((float)order / menuSize);
         }
     }
 }
Пример #8
0
    public IEnumerator Animate(float start, float end, float angle, float time, float waittime = 0f)
    {
        yield return(new WaitForSeconds(waittime));

        float myTime = 0f;

        while (myTime < time)
        {
            myTime += Time.deltaTime;
            float   x        = ac.Evaluate(myTime / time);
            Vector3 startPos = Publics.CirclePos(start, angle);
            Vector3 endPos   = Publics.CirclePos(end, angle);
            transform.localPosition = Vector3.Lerp(startPos, endPos, x);
            yield return(null);
        }
        transform.localPosition = Publics.CirclePos(end, angle);
        if (end == 0f)
        {
            gameObject.SetActive(false);
        }
    }
Пример #9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                int port = Convert.ToInt32(txtPort.Text);
            }
            catch (Exception)
            {
                Global.ShowSysInfo("端口号必须为整数!");
                return;
            }

            string ip = txtIp.Text.Replace(" ", "");

            if (ip == "127.0.0.1")
            {
                ip = "(local)";
            }
            else
            {
                if (txtPort.Text != "1433")
                {
                    ip += "," + txtPort.Text;
                }
            }

            string newconn = ConnetionString.Substring(0, ConnetionString.IndexOf('=') + 1) + ip + ConnetionString.Substring(ConnetionString.IndexOf(';'));

            string sConnection = ConfigurationManager.AppSettings["ConnectionString"];

            Publics.UpdateConfig(Application.ExecutablePath, sConnection, Crypto.EncryptString(newconn));
            ConfigurationManager.RefreshSection("appSettings");

            DialogResult = DialogResult.OK;
            this.Close();
        }
Пример #10
0
 private void btnView_Click(object sender, EventArgs e)
 {
     MessageBox.Show(Publics.GetRegisterNumber(Program.CpuInfo), "查看注册码");
 }
Пример #11
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(txtManID.Text))
                {
                    MessageBox.Show("用户名不能为空!", PublicConsts.PC_Tip);
                    txtManID.Focus();
                    return;
                }

                if (String.IsNullOrEmpty(txtPassword.Text))
                {
                    MessageBox.Show("密码不能为空!", PublicConsts.PC_Tip);
                    txtPassword.Focus();
                    return;
                }

                SysOnline so = SqlBaseProvider.GetSysOnline(txtManID.Text);

                if (!String.IsNullOrEmpty(so.ManID))
                {
                    MessageBox.Show("您的用户名已经登陆,不能重复登录!", PublicConsts.PC_Tip);
                    txtManID.Focus();
                    return;
                }

                UserCache uc = SqlBaseProvider.GetLoginInfo(txtManID.Text, String.Empty, String.Empty);

                if (String.IsNullOrEmpty(uc.Company.CoID) || String.IsNullOrEmpty(uc.Dept.DeptID) || String.IsNullOrEmpty(uc.Man.ManID))
                {
                    MessageBox.Show("您的员工资料不正确,不能登录本系统!", PublicConsts.PC_Tip);
                    txtManID.Focus();
                    return;
                }

                if (Crypto.MD5Crypto(txtPassword.Text) != uc.Man.OperPassword)
                {
                    MessageBox.Show("密码输入错误,请核实!", PublicConsts.PC_Tip);
                    txtPassword.Focus();
                    txtPassword.Text = String.Empty;
                    return;
                }

                //Program.ManInfo = uc;

                if (uc.Man.IsFirst)
                {
                    MessageBox.Show("您的用户名第一次登录本系统,请修改原始密码后重新登录!", PublicConsts.PC_Tip);
                    txtPassword.Text  = String.Empty;
                    this.DialogResult = DialogResult.Yes;
                }
                else
                {
                    SysRegister sr = SqlBaseProvider.GetSysRegister(Publics.GetRegisterNumber(Program.CpuInfo));

                    short ml = SqlBaseProvider.GetSetManLevel();

                    if (uc.Man.IsLock)
                    {
                        Global.ShowSysInfo("您的用户名被锁定,不能登录系统!" + StringHelper.WriteEnter(1) + "请与部门负责人或者系统管理员联系进行解锁!");
                        txtManID.Focus();
                        this.DialogResult = DialogResult.Cancel;
                        return;
                    }

                    so.ManID = txtManID.Text;
                    so.RegID = sr.RegID;

                    SqlBaseProvider.LoginSysOnline(so, DataProviderAction.Create);


                    Publics.UpdateConfig(Application.ExecutablePath, "IsRememberMe", chbRemember.Checked.ToString());
                    Publics.UpdateConfig(Application.ExecutablePath, "RememberUser", txtManID.Text);
                    ConfigurationManager.RefreshSection("appSettings");

                    uc.Register     = sr;
                    Program.ManInfo = uc;

                    this.DialogResult = DialogResult.OK;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, PublicConsts.PC_Tip);
                return;
            }
        }
Пример #12
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            System.Diagnostics.Process[] papp = System.Diagnostics.Process.GetProcessesByName(Application.ProductName);
            if (papp.Length > 1)
            {
                SetForegroundWindow(Process.GetCurrentProcess().MainWindowHandle);
            }
            else
            {
                SetForegroundWindow(Process.GetCurrentProcess().MainWindowHandle);
            }

            Program.NowLoginMan = String.Empty;

            if (true)
            {
                bool isDB = true;
                while (isDB)
                {
                    try
                    {
                        SqlConnection conn = DBUtils.GetConnection();
                        if (conn.State == ConnectionState.Open)
                        {
                            conn.Close();
                            conn.Dispose();
                            isDB = false;
                        }
                        else
                        {
                            throw new Exception("指定的数据库不存在或者数据库配置错误!");
                        }
                    }
                    catch (Exception)
                    {
                        Global.ShowSysInfo("指定的数据库不存在或者数据库配置错误!");
                        DBConfig     dbconfig    = new DBConfig();
                        DialogResult dbconfigrtn = dbconfig.ShowDialog();
                        dbconfig.Dispose();

                        if (dbconfigrtn != DialogResult.OK)
                        {
                            return;
                        }
                    }
                }

                Program.CpuInfo = Publics.GetFirstMacAddress();
                // 判断是否首次注册
                SysRegister sr = SqlBaseProvider.GetSysRegister(Publics.GetRegisterNumber(Program.CpuInfo));

                // 如果未注册则进行注册
                if (String.IsNullOrEmpty(sr.DeptID))
                {
                    Register rgForm = new Register();
                    if (rgForm.ShowDialog() != DialogResult.OK)
                    {
                        Application.Exit();
                    }
                }
            }

            Login lg = new Login();

FirstLogined:
            DialogResult rtn = lg.ShowDialog();

            Program.NowLoginMan = lg.txtManID.Text;

            if (rtn == DialogResult.OK)
            {
GotoMain:
                Application.Run(new MainForm());
                if (isCancel)
                {
                    isCancel = false;
                    goto GotoMain;
                }
            }
            else if (rtn == DialogResult.Yes)
            {
                FirstLogin first = new FirstLogin();

                if (first.ShowDialog() == DialogResult.OK)
                {
                    goto FirstLogined;
                }
                else
                {
                    Application.Exit();
                }
            }
            else
            {
                Application.Exit();
            }
        }
Пример #13
0
 private void Register_Load(object sender, EventArgs e)
 {
     lblRegNumber.Text = Publics.GetRegisterNumber(Program.CpuInfo);
 }