예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        TextBox1.Text = DateTime.Now.ToString();
        MembershipUser ma = Membership.GetUser();

        TextBox2.Text = ma.ProviderUserKey.ToString();
        if (User.IsInRole("client"))
        {
            DataView dv2 = (DataView)ClientIdSelect.Select(DataSourceSelectArguments.Empty);
            TextBox3.Text = (string)dv2.Table.Rows[0][0];
            Client.Insert();
            Response.Redirect("~/Client/ClientAccount");
        }
        else if (User.IsInRole("admin"))
        {
            DataView dv2 = (DataView)EmpIdSelect.Select(DataSourceSelectArguments.Empty);
            TextBox3.Text = (string)dv2.Table.Rows[0][0];
            Emp.Insert();
            Response.Redirect("~/admin/admin.aspx");
        }
        else if (User.IsInRole("ysa"))
        {
            Response.Redirect("");
        }
        else if (User.IsInRole("yc"))
        {
            Response.Redirect("");
        }
        else
        {
            Response.Redirect("default.aspx");
        }
    }
예제 #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            // check Error
            if (dateStartDate.Value > DateTime.Today)
            {
                MessageBox.Show("ระบุวันเริ่มงานด้วย", "เริ่มงาน?", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                dateStartDate.Focus();
                return;
            }
            if (chkisQuitted.Checked && ndateQuitDate.Value == null)
            {
                MessageBox.Show("ระบุวันออกจากงานด้วย", "ออกจากงาน?", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                ndateQuitDate.Focus();
                return;
            }
            if (empTypeIDMyCombo.SelectedIndex == -1)
            {
                MessageBox.Show("เลือกตำแหน่งด้วย", "ตำแหน่ง?", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                empTypeIDMyCombo.Focus();
                return;
            }
            // copy UIData to emp1
            emp1.name      = txtName.Text;
            emp1.fullName  = txtFullName.Text;
            emp1.tel       = txtTel.Text;
            emp1.email     = txtEmail.Text;
            emp1.salary    = decSalary.Value;
            emp1.bundle    = ndecBundle.Value;
            emp1.startDate = dateStartDate.Value;
            emp1.isQuitted = chkisQuitted.Checked ? 1 : 0;

            /*if (!chkisQuitted.Checked)
             * emp1.quitDate = null;
             * else
             *  emp1.quitDate = ndateQuitDate.Value;*/
            emp1.quitDate  = ndateQuitDate.Value;
            emp1.empTypeID = (int)empTypeIDMyCombo.SelectedValue;
            if (formState == EditState.Adding)
            {
                emp1.id = emp1.Insert(emp1);
                // Update DataTable ในตัวอย่าง ใช้ refresh
            }
            else
            {
                // ถ้า update ให้ค่า id
                emp1.id = int.Parse(inbID.Text);
                emp1.Update(emp1);
                // Update DataTable ในตัวอย่าง ใช้ refresh
            }
            // refresh Data
            selectEmpsMyCombo_SelectedIndexChanged(sender, e);
            empListBox_SelectedValueChanged(sender, e);

            formState = EditState.Viewing;
            setFromState();
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 检查是否是安装了ccflow如果没有就让其安装.
            try
            {
                //如果没有Port_Dept 表就可能没有安装ccflow.
                DBAccess.RunSQL("SELECT * FROM Port_Dept WHERE 1=2");
            }
            catch
            {
                /*数据库链接不通或者有异常,说明没有安装.*/
                this.Response.Redirect("../DBInstall.aspx", true);
                return;
            }
            #endregion 检查是否是安装了ccflow如果没有就让其安装.

            #region 执行admin登陆.
            Emp emp = new Emp();
            emp.No = "admin";
            if (emp.RetrieveFromDBSources() == 1)
            {
                BP.Web.WebUser.SignInOfGener(emp, true);
            }
            else
            {
                emp.No      = "admin";
                emp.Name    = "admin";
                emp.FK_Dept = "01";
                emp.Pass    = "******";
                emp.Insert();
                BP.Web.WebUser.SignInOfGener(emp, true);
                //throw new Exception("admin 用户丢失,请注意大小写。");
            }
            #endregion 执行admin登陆.

            // 执行升级, 现在升级代码移动到 Glo 里面了。
            string str = BP.WF.Glo.UpdataCCFlowVer(); //执行升级.
            if (str != null)
            {
                //   this.Response.Write(str);
                if (str == "0")
                {
                    BP.Sys.PubClass.Alert("系统升级错误,请查看日志文件\\DataUser/\\log");
                }
                else
                {
                    BP.Sys.PubClass.Alert("系统成功升级到:" + str + " ,系统升级不会破坏现有的数据。");
                }
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 检查是否是安装了ccflow如果没有就让其安装.
            /*数据库链接不通或者有异常,说明没有安装.*/
            if (BP.DA.DBAccess.IsExitsObject("WF_Emp") == false)
            {
                this.Response.Redirect("../DBInstall.aspx", true);
                return;
            }
            #endregion 检查是否是安装了ccflow如果没有就让其安装.

            #region 执行admin登陆.
            Emp emp = new Emp();
            emp.No = "admin";
            if (emp.RetrieveFromDBSources() == 1)
            {
                BP.Web.WebUser.SignInOfGener(emp, true);
            }
            else
            {
                emp.No      = "admin";
                emp.Name    = "admin";
                emp.FK_Dept = "01";
                emp.Pass    = "******";
                emp.Insert();
                BP.Web.WebUser.SignInOfGener(emp, true);
                //throw new Exception("admin 用户丢失,请注意大小写。");
            }
            #endregion 执行admin登陆.

            // 执行升级, 现在升级代码移动到 Glo 里面了。
            string str = BP.WF.Glo.UpdataCCFlowVer(); //执行升级.
            if (str != null)
            {
                //   this.Response.Write(str);
                if (str == "0")
                {
                    BP.Sys.PubClass.Alert("系统升级错误,请查看日志文件\\DataUser\\log");
                }
                else
                {
                    BP.Sys.PubClass.Alert("系统成功升级到:" + str + " ,系统升级不会破坏现有的数据,ccbpm6的升级都是保证向下兼容的。");
                }
            }
        }
예제 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DateTime     now      = DateTime.Now;
        TimeZoneInfo timezone = TimeZoneInfo.FindSystemTimeZoneById("Singapore Standard Time");

        TextBox1.Text = TimeZoneInfo.ConvertTime(now, timezone).ToString();

        MembershipUser ma = Membership.GetUser();

        TextBox2.Text = ma.ProviderUserKey.ToString();
        if (User.IsInRole("client"))
        {
            DataView dv2 = (DataView)ClientIdSelect.Select(DataSourceSelectArguments.Empty);
            TextBox3.Text         = Convert.ToString((int)dv2.Table.Rows[0][0]);
            Session["ClientID"]   = Convert.ToString((int)dv2.Table.Rows[0][0]);
            Session["ClientName"] = (string)dv2.Table.Rows[0][1];
            Client.Insert();
            Response.Redirect("~/Client/ClientAccount.aspx");
        }
        else if (User.IsInRole("admin"))
        {
            DataView dv2 = (DataView)EmpIdSelect.Select(DataSourceSelectArguments.Empty);
            TextBox3.Text           = Convert.ToString((int)dv2.Table.Rows[0][0]);
            Session["EmployeeID"]   = Convert.ToString((int)dv2.Table.Rows[0][0]);
            Session["EmployeeName"] = (string)dv2.Table.Rows[0][2];
            Emp.Insert();
            Response.Redirect("~/Admin/Admin.aspx");
        }
        else if (User.IsInRole("ysa"))
        {
            Response.Redirect("");
        }
        else if (User.IsInRole("yc"))
        {
            Response.Redirect("");
        }
        else
        {
            Response.Redirect("default.aspx");
        }
    }
        public IHttpActionResult PostEmployee(Employee employee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Emp  obj    = new Emp();
            bool result = obj.Insert(employee);

            if (result)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }


            //db.Employees.Add(employee);
            //db.SaveChanges();
            //return CreatedAtRoute("DefaultApi", new { id = employee.Eid }, employee);
        }
예제 #7
0
        /// <summary>
        /// 通用的登陆
        /// </summary>
        /// <param name="guestNo">客户编号</param>
        /// <param name="guestName">客户名称</param>
        /// <param name="deptNo">部门编号</param>
        /// <param name="deptName">部门名称</param>
        /// <param name="lang">语言</param>
        /// <param name="isRememberMe">是否记忆我</param>
        public static void SignInOfGener(string guestNo, string guestName, string deptNo,
                                         string deptName, string lang, bool isRememberMe)
        {
            if (System.Web.HttpContext.Current == null)
            {
                SystemConfig.IsBSsystem = false;
            }
            else
            {
                SystemConfig.IsBSsystem = true;
            }

            //记录客人信息.
            GuestUser.No       = guestNo;
            GuestUser.Name     = guestName;
            GuestUser.DeptNo   = deptNo;
            GuestUser.DeptName = deptName;


            //记录内部客户信息.
            BP.Port.Emp em = new Emp();
            em.No = "Guest";
            if (em.RetrieveFromDBSources() == 0)
            {
                em.Name = "客人";
                em.Insert();
            }
            WebUser.No          = em.No;
            WebUser.Name        = em.Name;
            WebUser.FK_Dept     = em.FK_Dept;
            WebUser.FK_DeptName = em.FK_DeptText;
            WebUser.HisStations = null;
            WebUser.SysLang     = lang;
            if (BP.Sys.SystemConfig.IsBSsystem)
            {
                // Guest  信息.
                HttpCookie cookie = new HttpCookie("CCSGuest");
                //cookie.Expires = DateTime.Now.AddMonths(10);
                cookie.Expires = DateTime.Now.AddDays(2);
                cookie.Values.Add("GuestNo", guestNo);
                cookie.Values.Add("GuestName", HttpUtility.UrlEncode(guestName));
                cookie.Values.Add("DeptNo", deptNo);
                cookie.Values.Add("DeptName", HttpUtility.UrlEncode(deptName));
                System.Web.HttpContext.Current.Response.AppendCookie(cookie); //加入到会话。


                HttpCookie cookie2 = new HttpCookie("CCS");
                cookie2.Expires = DateTime.Now.AddDays(2);
                // Guest  信息.
                cookie2.Values.Add("GuestNo", guestNo);
                cookie2.Values.Add("GuestName", HttpUtility.UrlEncode(guestName));

                cookie2.Values.Add("DeptNo", deptNo);
                cookie2.Values.Add("DeptName", HttpUtility.UrlEncode(deptName));

                cookie2.Values.Add("No", "Guest");
                cookie2.Values.Add("Name", HttpUtility.UrlEncode(em.Name));

                if (isRememberMe)
                {
                    cookie2.Values.Add("IsRememberMe", "1");
                }
                else
                {
                    cookie2.Values.Add("IsRememberMe", "0");
                }

                cookie2.Values.Add("FK_Dept", em.FK_Dept);
                cookie2.Values.Add("FK_DeptName", HttpUtility.UrlEncode(em.FK_DeptText));

                cookie2.Values.Add("Token", System.Web.HttpContext.Current.Session.SessionID);
                cookie2.Values.Add("SID", System.Web.HttpContext.Current.Session.SessionID);

                cookie2.Values.Add("Lang", lang);
                cookie2.Values.Add("Style", "0");
                cookie2.Values.Add("Auth", ""); //授权人.
                System.Web.HttpContext.Current.Response.AppendCookie(cookie2);
            }
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //如果没有Port_Dept 表就可能没有安装ccflow.
                DBAccess.RunSQL("SELECT * FROM Port_Dept WHERE 1=2");
            }
            catch
            {
                /*数据库链接不通或者有异常,说明没有安装.*/
                this.Response.Redirect("../DBInstall.aspx", true);
                return;
            }

            if (this.IsCheckUpdate == false)
            {
                #region 执行admin登陆.
                Emp emp = new Emp();
                emp.No = "admin";
                if (emp.RetrieveFromDBSources() == 1)
                {
                    BP.Web.WebUser.SignInOfGener(emp, true);
                }
                else
                {
                    emp.No      = "admin";
                    emp.Name    = "admin";
                    emp.FK_Dept = "01";
                    emp.Pass    = "******";
                    emp.Insert();
                    BP.Web.WebUser.SignInOfGener(emp, true);
                    //throw new Exception("admin 用户丢失,请注意大小写。");
                }
                #endregion 执行admin登陆.
                return;
            }

            string sql = "";
            string msg = "";
            try
            {
                msg = "@登陆时错误。";
                DBAccess.RunSQL("DELETE Sys_Enum WHERE EnumKey IN ('DeliveryWay','RunModel','OutTimeDeal')");

                BP.Port.Unit u = new BP.Port.Unit();
                u.CheckPhysicsTable();

                //部门
                BP.Port.Dept d = new BP.Port.Dept();
                d.CheckPhysicsTable();

                int i = DBAccess.RunSQLReturnValInt("SELECT COUNT(*) FROM Port_Unit");
                if (i == 0)
                {
                    DBAccess.RunSQL("INSERT INTO Port_Unit (No,Name, ParentNo)VALUES('1','济南驰骋信息技术有限公司','-1')");
                }

                GenerWorkFlow gwf = new GenerWorkFlow();
                gwf.CheckPhysicsTable();

                Flow fl = new Flow();
                fl.CheckPhysicsTable();

                Node nd = new Node();
                nd.CheckPhysicsTable();

                SMS sms = new SMS();
                sms.CheckPhysicsTable();

                #region 执行admin登陆. 2012-12-25 新版本.
                Emp emp = new Emp();
                emp.No = "admin";
                if (emp.RetrieveFromDBSources() == 1)
                {
                    BP.Web.WebUser.SignInOfGener(emp, true);
                }
                else
                {
                    emp.No      = "admin";
                    emp.Name    = "admin";
                    emp.FK_Dept = "01";
                    emp.Pass    = "******";
                    emp.Insert();
                    BP.Web.WebUser.SignInOfGener(emp, true);
                    //throw new Exception("admin 用户丢失,请注意大小写。");
                }
                #endregion 执行admin登陆.
            }
            catch (Exception ex)
            {
                this.Response.Write("问题出处:" + ex.Message + "<hr>" + msg + "<br>详细信息:@" + ex.StackTrace + "<br>@<a href='../DBInstall.aspx' >点这里到系统升级界面。</a>");
                return;
            }
        }