Ejemplo n.º 1
0
    private void DoAlertMsg(ArrayList TaskInfos)
    {
        string[] strArray        = new string[] { ConfigurationSettings.AppSettings["Artificial consumption"], ConfigurationSettings.AppSettings["Material consumption"], ConfigurationSettings.AppSettings["Equipment consumption"] };
        UserInfo currentUserInfo = userManageDb.GetCurrentUserInfo();

        for (int i = 0; i < TaskInfos.Count; i++)
        {
            ConstructTaskBook book = (ConstructTaskBook)TaskInfos[i];
            for (int j = 0; j < strArray.Length; j++)
            {
                AlertPoint point = new AlertPoint(strArray[j]);
                if (point.Options[2].IsSelected)
                {
                    SchedulePlanAction action = new SchedulePlanAction();
                    new ResourceItemAction();
                    AlertMessage message = new AlertMessage();
                    if (currentUserInfo != null)
                    {
                        message.ManInput = currentUserInfo.UserCode;
                    }
                    message.MenAlertTo     = point.YHDMsOfPeopleAlertTo;
                    message.TimeInput      = DateTime.Now;
                    message.TimeOutput     = DateTime.Now;
                    message.TimeOver       = DateTime.Now.AddDays(point.ValidTimeLong);
                    message.PresentimentID = point.pkID;
                    message.PrjCode        = this.ProjectCode.ToString();
                    DataTable table = TaskBookAction.DoAlert(this.ProjectCode, book.TaskCode, j + 1, book.TaskBookCode);
                    if (table.Rows.Count > 0)
                    {
                        foreach (DataRow row in table.Rows)
                        {
                            decimal num3 = (decimal.Parse(row["ResBudget"].ToString()) == 0M) ? 0M : (decimal.Parse(row["ResConsum"].ToString()) / decimal.Parse(row["ResBudget"].ToString()));
                            decimal num4 = (decimal.Parse(row["Quantity"].ToString()) == 0M) ? 0M : (decimal.Parse(row["Complete"].ToString()) / decimal.Parse(row["Quantity"].ToString()));
                            if (num3 > num4)
                            {
                                message.Message = string.Concat(new object[] { PrjInfoAction.GetProjectNameOfCode(this.ProjectCode.ToString()), "&nbsp;&nbsp;", action.GetTaskName(this.ProjectCode, book.TaskCode), "&nbsp;&nbsp;", row["ResourceName"].ToString(), "消耗比例超过工程完成比例(", decimal.Round(num3 * 100M, 2), "%/", decimal.Round(num4 * 100M, 2), "%)." });
                                message.Send();
                            }
                        }
                    }
                }
            }
        }
    }