Exemplo n.º 1
0
		public MainUI () : base ("MainUI", null)
		{
			cPerson oUser;
			oUser = new cPerson ();
			cDeathCalculator dCalc;
			dCalc = new cDeathCalculator ();
			oUser.Age = 28;
			oUser.CigPerDay = 0;
			dCalc.

		}
Exemplo n.º 2
0
		// This is the main entry point of the application.
		static void Main (string[] args)
		{
			// if you want to use a different Application Delegate class from "AppDelegate"
			// you can specify it here.
			UIApplication.Main (args, null, "AppDelegate");
			cPerson oUser;
			oUser = new cPerson ();
			cDeathCalculator dCalc;
			dCalc = new cDeathCalculator ();
			oUser.Age = 28;
			oUser.CigPerDay = 0;
			dCalc.FindTimeLeft (oUser);

		}
Exemplo n.º 3
0
        public static void InsertPerson(cPerson person)
        {
            using (AppDbContext db = new AppDbContext())
            {
                /*
                 * db.Add(new cPerson{
                 *  Name = "Tania",
                 *  Email = "*****@*****.**",
                 *  Salary = 1234,
                 *  Birthday = new DateTime(1875,11,12),
                 *  Gender = 'F'
                 * });
                 */
                db.Add(person);

                // State 01:
                ShowStates(db.ChangeTracker.Entries());

                db.SaveChanges();

                // State 02:
                ShowStates(db.ChangeTracker.Entries());
            }
        }
Exemplo n.º 4
0
 public cPhysicalVC(cPerson oUser) : base("cPhysicalVC", null)
 {
     _User = oUser;
 }
Exemplo n.º 5
0
        private void BindGridView(int nPageNo)
        {
            cPerson oPerson                    = new cPerson();
            DataSet ds                         = new DataSet();
            string  strMessage                 = string.Empty;
            string  strCriteria                = string.Empty;
            string  strperson_group_code       = string.Empty;
            string  strdirector_code           = string.Empty;
            string  strunit_code               = string.Empty;
            string  strperson_code             = string.Empty;
            string  strperson_name             = string.Empty;
            string  strperson_work_status_code = string.Empty;
            string  struser_group_code         = string.Empty;
            string  struser_group_list         = string.Empty;

            strperson_group_code       = cboPerson_group.SelectedValue;
            strdirector_code           = cboDirector.SelectedValue;
            strunit_code               = cboUnit.SelectedValue;
            strperson_work_status_code = cboPerson_work_status.SelectedValue;
            strperson_code             = txtperson_code.Text.Replace("'", "''").Trim();
            strperson_name             = txtperson_name.Text.Replace("'", "''").Trim();
            struser_group_list         = cboUserGroup.SelectedValue;

            var strperson_id = txtperson_id.Text.Replace("'", "''").Trim();

            if (!strperson_id.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_id like '%" + strperson_id + "%') ";
            }

            if (Request.Form[strPrefixCtr + "cboPerson_work_status"] != null)
            {
                strperson_work_status_code = Request.Form[strPrefixCtr + "cboPerson_work_status"].ToString();
            }
            if (!strperson_group_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_group_code like '%" + strperson_group_code + "%') ";
            }

            if (!strdirector_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (director_code = '" + strdirector_code + "') ";
            }

            if (!strunit_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (unit_code= '" + strunit_code + "') ";
            }

            if (!strperson_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_code= '" + strperson_code + "') ";
            }

            if (!strperson_name.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_thai_name like '%" + strperson_name + "%'  " +
                              "  OR person_thai_surname like '%" + strperson_name + "%'  " +
                              "  OR person_eng_name like '%" + strperson_name + "%'  " +
                              "  OR person_eng_surname like '%" + strperson_name + "%')";
            }

            if (!strperson_work_status_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_work_status_code= '" + strperson_work_status_code + "') ";
            }

            if (RadioActive.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='Y') ";
            }
            else if (RadioCancel.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='N') ";
            }
            if (!struser_group_list.Equals(""))
            {
                if (struser_group_list == "User")
                {
                    strCriteria = strCriteria + "  And  (user_group_list is null or user_group_list  = '') ";
                }
                else
                {
                    strCriteria = strCriteria + "  And  (user_group_list  Like '%" + struser_group_list + "%') ";
                }
            }

            try
            {
                if (!oPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage))
                {
                    lblError.Text = strMessage;
                }
                else
                {
                    try
                    {
                        GridView1.PageIndex           = nPageNo;
                        txthTotalRecord.Value         = ds.Tables[0].Rows.Count.ToString();
                        ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                        GridView1.DataSource          = ds.Tables[0];
                        GridView1.DataBind();
                    }
                    catch
                    {
                        GridView1.PageIndex           = 0;
                        txthTotalRecord.Value         = ds.Tables[0].Rows.Count.ToString();
                        ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                        GridView1.DataSource          = ds.Tables[0];
                        GridView1.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message.ToString();
            }
            finally
            {
                oPerson.Dispose();
                ds.Dispose();
                if (GridView1.Rows.Count > 0)
                {
                    GridView1.TopPagerRow.Visible = true;
                }
            }
        }
Exemplo n.º 6
0
        private void BindGridView()
        {
            InitcboWork_status();
            InitcboPerson_group();

            cPerson oPerson               = new cPerson();
            DataSet ds                    = new DataSet();
            string  strMessage            = string.Empty;
            string  strCriteria           = string.Empty;
            string  strYear               = string.Empty;
            string  strActive             = string.Empty;
            string  strperson_group_code  = string.Empty;
            string  strperson_group_name  = string.Empty;
            string  strunit_code          = string.Empty;
            string  strdirector_code      = string.Empty;
            string  strperson_code        = string.Empty;
            string  strperson_name        = string.Empty;
            string  strperson_manage_name = string.Empty;

            string strperson_work_status_code = string.Empty;

            strperson_group_code       = cboPerson_group.Text;
            strdirector_code           = cboDirector.SelectedValue;
            strunit_code               = cboUnit.SelectedValue;
            strperson_code             = txtperson_code.Text.Replace("'", "''").Trim();
            strperson_name             = txtperson_name.Text.Replace("'", "''").Trim();
            strperson_manage_name      = txtperson_manage_name.Text.Replace("'", "''").Trim();
            strperson_work_status_code = cboPerson_work_status.SelectedValue;

            if (!strYear.Equals(""))
            {
                strCriteria = strCriteria + "  And  (budget_plan_year = '" + strYear + "') ";
            }

            if (!strperson_group_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_group_code like '%" + strperson_group_code + "%') ";
            }

            if (!strdirector_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (director_code = '" + strdirector_code + "') ";
            }

            if (!strunit_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (unit_code= '" + strunit_code + "') ";
            }

            if (!strperson_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_code= '" + strperson_code + "') ";
            }

            if (!strperson_manage_name.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_manage_name like '%" + strperson_manage_name + "%') ";
            }


            if (!strperson_name.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_thai_name like '%" + strperson_name + "%'  " +
                              "  OR person_thai_surname like '%" + strperson_name + "%'  " +
                              "  OR person_eng_name like '%" + strperson_name + "%'  " +
                              "  OR person_eng_surname like '%" + strperson_name + "%'" +
                              "  OR '" + strperson_name + "' like ('%'+person_thai_name+'%'+person_thai_surname+'%')) ";
            }

            if (!strperson_work_status_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_work_status_code= '" + strperson_work_status_code + "') ";
            }

            if (RadioActive.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='Y') ";
            }
            else if (RadioCancel.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='N') ";
            }

            //strCriteria += " and person_group_code IN (" + PersonGroupList + ") ";
            //if (DirectorLock == "Y")
            //{
            //    strCriteria += " and substring(director_code,4,2) = substring('" + DirectorCode + "',4,2) ";
            //}


            try
            {
                if (!oPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage))
                {
                    lblError.Text = strMessage;
                }
                else
                {
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        string strScript = string.Empty;
                        strperson_code = ds.Tables[0].Rows[0]["person_code"].ToString();
                        strperson_name = ds.Tables[0].Rows[0]["person_thai_name"].ToString() + " " + ds.Tables[0].Rows[0]["person_thai_surname"].ToString();

                        if (!ViewState["show"].ToString().Equals("1"))
                        {
                            strScript = "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + strperson_code + "';\n " +
                                        "window.parent.frames['iframeShow" + (int.Parse(ViewState["show"].ToString()) - 1) + "'].document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + strperson_name + "';\n" +
                                        "ClosePopUp('" + ViewState["show"].ToString() + "');";
                        }
                        else
                        {
                            strScript = "window.parent.document.getElementById('" + ViewState["ctrl1"].ToString() + "').value='" + strperson_code + "';\n " +
                                        "window.parent.document.getElementById('" + ViewState["ctrl2"].ToString() + "').value='" + strperson_name + "';\n" +
                                        "ClosePopUp('" + ViewState["show"].ToString() + "');";
                        }
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "close", strScript, true);
                    }
                    else
                    {
                        ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                        GridView1.DataSource          = ds.Tables[0];
                        GridView1.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message.ToString();
            }
            finally
            {
                oPerson.Dispose();
                ds.Dispose();
            }
        }
Exemplo n.º 7
0
 public cLifeStyleVC(cPerson voUser) : base("cLifeStyleVC", null)
 {
     _User = voUser;
     //imgLifestyle.Image = UIImage.FromBundle ("Images/life.png");
     //imgLogo.Image = UIImage.FromBundle ("Images/apple.jpg");
 }
Exemplo n.º 8
0
        private void BindGridView(int nPageNo)
        {
            InitcboYear();
            InitcboWork_status();
            InitcboPerson_group();
            //InitcboDirector();
            // InitcboUnit();
            cPerson oPerson                    = new cPerson();
            DataSet ds                         = new DataSet();
            string  strMessage                 = string.Empty;
            string  strCriteria                = string.Empty;
            string  strYear                    = string.Empty;
            string  strActive                  = string.Empty;
            string  strperson_group_code       = string.Empty;
            string  strperson_group_name       = string.Empty;
            string  strdirector_code           = string.Empty;
            string  strunit_code               = string.Empty;
            string  strperson_code             = string.Empty;
            string  strperson_name             = string.Empty;
            string  strperson_work_status_code = string.Empty;

            strperson_group_code       = cboPerson_group.SelectedValue;
            strdirector_code           = cboDirector.SelectedValue;
            strunit_code               = cboUnit.SelectedValue;
            strperson_work_status_code = cboPerson_work_status.SelectedValue;
            strYear        = cboYear.SelectedValue;
            strperson_code = txtperson_code.Text.Replace("'", "''").Trim();
            strperson_name = txtperson_name.Text.Replace("'", "''").Trim();
            if (Request.Form[strPrefixCtr + "cboPerson_work_status"] != null)
            {
                strperson_work_status_code = Request.Form[strPrefixCtr + "cboPerson_work_status"].ToString();
            }

            //if (!strYear.Equals(""))
            //{
            //    strCriteria = strCriteria + "  And  (budget_plan_year = '" + strYear + "') ";
            //}

            if (!strperson_group_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_group_code like '%" + strperson_group_code + "%') ";
            }

            if (!strdirector_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (director_code = '" + strdirector_code + "') ";
            }

            if (!strunit_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (unit_code= '" + strunit_code + "') ";
            }

            if (!strperson_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_code= '" + strperson_code + "') ";
            }

            if (!strperson_name.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_thai_name like '%" + strperson_name + "%'  " +
                              "  OR person_thai_surname like '%" + strperson_name + "%'  " +
                              "  OR person_eng_name like '%" + strperson_name + "%'  " +
                              "  OR person_eng_surname like '%" + strperson_name + "%')";
            }

            if (!strperson_work_status_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_work_status_code= '" + strperson_work_status_code + "') ";
            }

            if (RadioActive.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='Y') ";
            }
            else if (RadioCancel.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='N') ";
            }
            strCriteria += " and person_group_code IN (" + PersonGroupList + ",'') ";
            if (DirectorLock == "Y")
            {
                strCriteria += " and substring(director_code,4,2) = substring('" + DirectorCode + "',4,2) ";
            }
            try
            {
                if (!oPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage))
                {
                    lblError.Text = strMessage;
                }
                else
                {
                    try
                    {
                        GridView1.PageIndex           = nPageNo;
                        txthTotalRecord.Value         = ds.Tables[0].Rows.Count.ToString();
                        ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                        GridView1.DataSource          = ds.Tables[0];
                        GridView1.DataBind();
                    }
                    catch
                    {
                        GridView1.PageIndex           = 0;
                        txthTotalRecord.Value         = ds.Tables[0].Rows.Count.ToString();
                        ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                        GridView1.DataSource          = ds.Tables[0];
                        GridView1.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message.ToString();
            }
            finally
            {
                oPerson.Dispose();
                ds.Dispose();
                if (GridView1.Rows.Count > 0)
                {
                    GridView1.TopPagerRow.Visible = true;
                }
            }
        }
Exemplo n.º 9
0
 public cResultsVC(cPerson voUser)
 {
     _User = voUser;
     oCalc = new cDeathCalculator();
 }
Exemplo n.º 10
0
 public override void OnCreate()
 {
     base.OnCreate();
     _oUser = new cPerson();
 }
Exemplo n.º 11
0
        private void BindGridView()
        {
            InitcboWork_status();
            InitcboPerson_group();

            cPerson oPerson                    = new cPerson();
            DataSet ds                         = new DataSet();
            string  strMessage                 = string.Empty;
            string  strCriteria                = string.Empty;
            string  strYear                    = string.Empty;
            string  strActive                  = string.Empty;
            string  strperson_group_code       = string.Empty;
            string  strperson_group_name       = string.Empty;
            string  strmajor_code              = string.Empty;
            string  strperson_code             = string.Empty;
            string  strperson_name             = string.Empty;
            string  strperson_work_status_code = string.Empty;

            strperson_group_code       = cboPerson_group.Text;
            strmajor_code              = cboMajor.SelectedValue;
            strperson_code             = txtperson_code.Text.Replace("'", "''").Trim();
            strperson_name             = txtperson_name.Text.Replace("'", "''").Trim();
            strperson_work_status_code = cboPerson_work_status.SelectedValue;

            if (!strYear.Equals(""))
            {
                strCriteria = strCriteria + "  And  (budget_plan_year = '" + strYear + "') ";
            }

            if (!strperson_group_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_group_code like '%" + strperson_group_code + "%') ";
            }


            if (!strmajor_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (major_code= '" + strmajor_code + "') ";
            }

            if (!strperson_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_code= '" + strperson_code + "') ";
            }

            if (!strperson_name.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_thai_name like '%" + strperson_name + "%'  " +
                              "  OR person_thai_surname like '%" + strperson_name + "%'  " +
                              "  OR (person_thai_surname + ' ' +person_eng_surname) like '%" + strperson_name + "%')";
            }

            if (!strperson_work_status_code.Equals(""))
            {
                strCriteria = strCriteria + "  And  (person_work_status_code= '" + strperson_work_status_code + "') ";
            }

            if (RadioActive.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='Y') ";
            }
            else if (RadioCancel.Checked)
            {
                strCriteria = strCriteria + "  And  (c_active ='N') ";
            }

            strCriteria += " and person_group_code IN (" + PersonGroupList + ") ";


            if (DirectorLock == "Y")
            {
                strCriteria += " and substring(director_code,4,2) = substring('" + DirectorCode + "',4,2) ";
            }



            try
            {
                if (!oPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage))
                {
                    lblError.Text = strMessage;
                }
                else
                {
                    ds.Tables[0].DefaultView.Sort = ViewState["sort"] + " " + ViewState["direction"];
                    GridView1.DataSource          = ds.Tables[0];
                    GridView1.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message.ToString();
            }
            finally
            {
                oPerson.Dispose();
                ds.Dispose();
            }
        }
Exemplo n.º 12
0
        private void GotoUserMode(string user_group_code)
        {
            //if (user_group_code == "001")
            //{
            //    if (SetPersonUserProfile(txtUser.Text, ref _strMessage))
            //    {
            //        Response.Redirect("Menu_control.aspx");
            //    }
            //}
            //else
            //{
            cUser_group objUserGroup = new cUser_group();
            DataTable   dt           = new DataTable();
            DataSet     ds           = new DataSet();
            string      strCriteria  = " and user_group_code = '" + user_group_code + "' ";
            string      strMessage   = string.Empty;

            objUserGroup.sp_USER_GROUP_SEL(strCriteria, ref ds, ref strMessage);
            dt = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                this.IsLogin      = "******";
                this.DirectorLock = Helper.CStr(dt.Rows[0]["director_lock"]);

                try
                {
                    this.UnitLock = Helper.CStr(dt.Rows[0]["unit_lock"]);
                }
                catch
                {
                    this.UnitLock = "N";
                }

                if (this.UnitLock == "Y")
                {
                    this.UnitCodeList = string.Empty;
                    string[] strunit_code_list = Helper.CStr(dt.Rows[0]["unit_code_list"]).Split(',');
                    for (int i = 0; i <= (strunit_code_list.GetUpperBound(0)); i++)
                    {
                        this.UnitCodeList += "'" + strunit_code_list[i].Substring(3, 5) + "',";
                    }
                    this.UnitCodeList = this.UnitCodeList.Substring(0, this.UnitCodeList.Length - 1);
                }

                string[] strperson_group_list = Helper.CStr(dt.Rows[0]["person_group_list"]).Split(',');
                for (int i = 0; i <= (strperson_group_list.GetUpperBound(0)); i++)
                {
                    PersonGroupList = PersonGroupList + "'" + strperson_group_list[i] + "',";
                }

                PersonGroupList = PersonGroupList.Substring(0, PersonGroupList.Length - 1);



                cPerson objPerson = new cPerson();
                strCriteria = " And person_code='" + this.PersonCode + "' ";
                objPerson.SP_PERSON_LIST_SEL(strCriteria, ref ds, ref strMessage);
                dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    this.UserLoginName = Helper.CStr(dt.Rows[0]["person_thai_name"]) + "  "
                                         + Helper.CStr(dt.Rows[0]["person_thai_surname"]);
                    this.DirectorCode   = Helper.CStr(dt.Rows[0]["director_code"]);
                    this.DirectorName   = Helper.CStr(dt.Rows[0]["director_name"]);
                    Session["username"] = Helper.CStr(dt.Rows[0]["person_thai_name"]) + "  "
                                          + Helper.CStr(dt.Rows[0]["person_thai_surname"]);
                }



                Response.Redirect("Menu_control.aspx");
            }
            // }
        }
Exemplo n.º 13
0
 public cResultsVC(cPerson voUser) : base("cResultsVC", null)
 {
     _User = voUser;
     oCalc = new cDeathCalculator();
 }
Exemplo n.º 14
0
 public NavViewController()
 {
     oUser = new cPerson();
     PhysicalViewController = new cPhysicalVC(oUser);
     PushViewController(PhysicalViewController, true);
 }