コード例 #1
0
        private int[] getHrsWeeks()
        {
            project current        = getCurrentProject(Convert.ToInt32(Request.QueryString["ProjectID"]));
            string  tenthruleinput = "";
            Boolean go             = false;

            if (tenthrulereadonly.Value == "??-??-??-??-??-??-??-??-??-??" && DropDownList1.SelectedIndex != 0)
            {
                SqlConnection con = new SqlConnection(Global.getConnectionString());
                SqlCommand    cmd = new SqlCommand("SELECT default_tenth_rule FROM pms_resource_role WHERE name=@name", con);
                cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = DropDownList1.SelectedValue;
                try
                {
                    con.Open();
                    tenthruleinput = cmd.ExecuteScalar().ToString();
                    go             = true;
                }
                catch
                {
                }
                finally
                {
                    con.Close();
                }
            }
            else if (tenthrulereadonly.Value != "??-??-??-??-??-??-??-??-??-??")
            {
                tenthruleinput = tenthrulereadonly.Value.ToString().Replace("-", "");
                go             = true;
            }
            else
            {
                go = false;
            }
            int[] hrsweeks = new int[10];
            if (go)
            {
                int[] curten   = current.calctenthrule(tenthruleinput, Convert.ToInt32(projecthours.Value));
                int   weeksper = current.getWeeksInOneTenth();

                for (int i = 0; i < 10; i++)
                {
                    hrsweeks[i] = curten[i] / weeksper;
                }
            }
            return(hrsweeks);
        }