/// <summary>
        /// 将Dataset的数据导入数据库
        /// </summary>
        /// <param name="pds">数据集</param>
        /// <param name="Cols">数据集行数</param>
        /// <returns></returns>
        private bool AddDatasetToSQL(DataTable pds, int Cols)
        {
            string result = string.Empty;
            int    ic, ir;

            ic = pds.Columns.Count;
            if (ic < Cols)
            {
                ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "行", MessageBoxIcon.Warning);
            }

            ir = pds.Rows.Count;
            if (pds != null && ir > 0)
            {
                var units = from x in Funs.DB.Base_Unit select x;
                for (int i = 0; i < ir; i++)
                {
                    string row1   = pds.Rows[i][0].ToString();
                    string unitId = string.Empty;
                    if (!string.IsNullOrEmpty(row1))
                    {
                        var unit = units.FirstOrDefault(x => x.UnitName == row1.Trim());
                        if (unit == null)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "单位名称" + "," + "[" + row1 + "]不存在!" + "|";
                        }
                        else
                        {
                            unitId = unit.UnitId;
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "单位名称" + "," + "此项为必填项!" + "|";
                    }

                    string row2 = pds.Rows[i][1].ToString();
                    if (!string.IsNullOrEmpty(row2))
                    {
                        try
                        {
                            Int32 year = Convert.ToInt32(row2.Trim());
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "年份" + "," + "[" + row2 + "]错误!" + "|";
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "年份" + "," + "此项为必填项!" + "|";
                    }

                    string row3 = pds.Rows[i][2].ToString();
                    if (!string.IsNullOrEmpty(row3))
                    {
                        try
                        {
                            Int32 month = Convert.ToInt32(row3.Trim());
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "月份" + "," + "[" + row3 + "]错误!" + "|";
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "月份" + "," + "此项为必填项!" + "|";
                    }

                    ////判断是否 已存在该月份数据
                    var millionsMonthlyReport = BLL.MillionsMonthlyReportService.GetMillionsMonthlyReportByUnitIdAndYearAndMonth(unitId, Funs.GetNewIntOrZero(row2.Trim()), Funs.GetNewIntOrZero(row3.Trim()));
                    if (millionsMonthlyReport != null)
                    {
                        result += "第" + (i + 2).ToString() + "行," + "已存在该月份月报!" + "|";
                    }

                    string row4 = pds.Rows[i][3].ToString();
                    if (string.IsNullOrEmpty(row4))
                    {
                        result += "第" + (i + 2).ToString() + "行," + "负责人" + "," + "此项为必填项!" + "|";
                    }
                    string row5 = pds.Rows[i][4].ToString().Trim();
                    if (!string.IsNullOrEmpty(row5))
                    {
                        try
                        {
                            Decimal recordableIncidentRate = Convert.ToDecimal(row5);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "百万工时总可记录事故率" + "," + "[" + row5 + "]错误!" + "|";
                        }
                    }
                    string row6 = pds.Rows[i][5].ToString().Trim();
                    if (!string.IsNullOrEmpty(row6))
                    {
                        try
                        {
                            Decimal lostTimeRate = Convert.ToDecimal(row6);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "百万工时损失工时率" + "," + "[" + row6 + "]错误!" + "|";
                        }
                    }
                    string row7 = pds.Rows[i][6].ToString().Trim();
                    if (!string.IsNullOrEmpty(row7))
                    {
                        try
                        {
                            Decimal lostTimeInjuryRate = Convert.ToDecimal(row7);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "百万工时损失工时伤害事故率" + "," + "[" + row7 + "]错误!" + "|";
                        }
                    }
                    string row8 = pds.Rows[i][7].ToString().Trim();
                    if (!string.IsNullOrEmpty(row8))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row8);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "百万工时死亡事故频率" + "," + "[" + row8 + "]错误!" + "|";
                        }
                    }
                    string row9 = pds.Rows[i][8].ToString().Trim();
                    if (!string.IsNullOrEmpty(row9))
                    {
                        try
                        {
                            Decimal accidentMortality = Convert.ToDecimal(row9);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "百万工时事故死亡率" + "," + "[" + row9 + "]错误!" + "|";
                        }
                    }
                    //string row10 = pds.Rows[i][9].ToString().Trim();
                    //string row11 = pds.Rows[i][10].ToString().Trim();
                    string row12 = pds.Rows[i][11].ToString().Trim();
                    if (!string.IsNullOrEmpty(row12))
                    {
                        try
                        {
                            Int32 postPersonNum = Convert.ToInt32(row12);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "在岗员工数" + "," + "[" + row12 + "]错误!" + "|";
                        }
                    }
                    string row13 = pds.Rows[i][12].ToString().Trim();
                    if (!string.IsNullOrEmpty(row13))
                    {
                        try
                        {
                            Int32 snapPersonNum = Convert.ToInt32(row13);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "临时员工数" + "," + "[" + row13 + "]错误!" + "|";
                        }
                    }
                    string row14 = pds.Rows[i][13].ToString().Trim();
                    if (!string.IsNullOrEmpty(row14))
                    {
                        try
                        {
                            Int32 contractorNum = Convert.ToInt32(row14);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "承包商数量" + "," + "[" + row14 + "]错误!" + "|";
                        }
                    }
                    string row15 = pds.Rows[i][14].ToString().Trim();
                    if (!string.IsNullOrEmpty(row15))
                    {
                        try
                        {
                            Int32 sumPersonNum = Convert.ToInt32(row15);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "员工总数合计" + "," + "[" + row15 + "]错误!" + "|";
                        }
                    }
                    string row16 = pds.Rows[i][15].ToString().Trim();
                    if (!string.IsNullOrEmpty(row16))
                    {
                        try
                        {
                            Decimal totalWorkNum = Convert.ToDecimal(row16);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "总工时数(万)" + "," + "[" + row16 + "]错误!" + "|";
                        }
                    }
                    string row17 = pds.Rows[i][16].ToString().Trim();
                    if (!string.IsNullOrEmpty(row17))
                    {
                        try
                        {
                            Int32 seriousInjuriesNum = Convert.ToInt32(row17);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "重伤事故起数" + "," + "[" + row17 + "]错误!" + "|";
                        }
                    }
                    string row18 = pds.Rows[i][17].ToString().Trim();
                    if (!string.IsNullOrEmpty(row18))
                    {
                        try
                        {
                            Int32 seriousInjuriesPersonNum = Convert.ToInt32(row18);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "重伤事故人数" + "," + "[" + row18 + "]错误!" + "|";
                        }
                    }
                    string row19 = pds.Rows[i][18].ToString().Trim();
                    if (!string.IsNullOrEmpty(row19))
                    {
                        try
                        {
                            Int32 seriousInjuriesLossHour = Convert.ToInt32(row19);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "重伤事故损失工时" + "," + "[" + row19 + "]错误!" + "|";
                        }
                    }
                    string row20 = pds.Rows[i][19].ToString().Trim();
                    if (!string.IsNullOrEmpty(row20))
                    {
                        try
                        {
                            Int32 minorAccidentNum = Convert.ToInt32(row20);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "轻伤事故起数" + "," + "[" + row20 + "]错误!" + "|";
                        }
                    }
                    string row21 = pds.Rows[i][20].ToString().Trim();
                    if (!string.IsNullOrEmpty(row21))
                    {
                        try
                        {
                            Int32 minorAccidentPersonNum = Convert.ToInt32(row21);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "轻伤事故人数" + "," + "[" + row21 + "]错误!" + "|";
                        }
                    }
                    string row22 = pds.Rows[i][21].ToString().Trim();
                    if (!string.IsNullOrEmpty(row22))
                    {
                        try
                        {
                            Int32 minorAccidentLossHour = Convert.ToInt32(row22);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "轻伤事故损失工时" + "," + "[" + row22 + "]错误!" + "|";
                        }
                    }
                    string row23 = pds.Rows[i][22].ToString().Trim();
                    if (!string.IsNullOrEmpty(row23))
                    {
                        try
                        {
                            Int32 otherAccidentNum = Convert.ToInt32(row23);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "其它事故起数" + "," + "[" + row23 + "]错误!" + "|";
                        }
                    }
                    string row24 = pds.Rows[i][23].ToString().Trim();
                    if (!string.IsNullOrEmpty(row24))
                    {
                        try
                        {
                            Int32 otherAccidentPersonNum = Convert.ToInt32(row24);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "其它事故人数" + "," + "[" + row24 + "]错误!" + "|";
                        }
                    }
                    string row25 = pds.Rows[i][24].ToString().Trim();
                    if (!string.IsNullOrEmpty(row25))
                    {
                        try
                        {
                            Int32 otherAccidentLossHour = Convert.ToInt32(row25);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "其它事故损失工时" + "," + "[" + row25 + "]错误!" + "|";
                        }
                    }
                    string row26 = pds.Rows[i][25].ToString().Trim();
                    if (!string.IsNullOrEmpty(row26))
                    {
                        try
                        {
                            Int32 restrictedWorkPersonNum = Convert.ToInt32(row26);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "工作受限人数" + "," + "[" + row26 + "]错误!" + "|";
                        }
                    }
                    string row27 = pds.Rows[i][26].ToString().Trim();
                    if (!string.IsNullOrEmpty(row27))
                    {
                        try
                        {
                            Int32 restrictedWorkLossHour = Convert.ToInt32(row27);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "工作受限损失工时" + "," + "[" + row27 + "]错误!" + "|";
                        }
                    }
                    string row28 = pds.Rows[i][27].ToString().Trim();
                    if (!string.IsNullOrEmpty(row28))
                    {
                        try
                        {
                            Int32 medicalTreatmentPersonNum = Convert.ToInt32(row28);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "医疗处置人数" + "," + "[" + row28 + "]错误!" + "|";
                        }
                    }
                    string row29 = pds.Rows[i][28].ToString().Trim();
                    if (!string.IsNullOrEmpty(row29))
                    {
                        try
                        {
                            Int32 medicalTreatmentLossHour = Convert.ToInt32(row29);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "医疗处置损失工时" + "," + "[" + row29 + "]错误!" + "|";
                        }
                    }
                    string row30 = pds.Rows[i][29].ToString().Trim();
                    if (!string.IsNullOrEmpty(row30))
                    {
                        try
                        {
                            Int32 fireNum = Convert.ToInt32(row30);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "火灾起数" + "," + "[" + row30 + "]错误!" + "|";
                        }
                    }
                    string row31 = pds.Rows[i][30].ToString().Trim();
                    if (!string.IsNullOrEmpty(row31))
                    {
                        try
                        {
                            Int32 explosionNum = Convert.ToInt32(row31);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "爆炸起数" + "," + "[" + row31 + "]错误!" + "|";
                        }
                    }
                    string row32 = pds.Rows[i][31].ToString().Trim();
                    if (!string.IsNullOrEmpty(row32))
                    {
                        try
                        {
                            Int32 trafficNum = Convert.ToInt32(row32);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "交通起数" + "," + "[" + row32 + "]错误!" + "|";
                        }
                    }
                    string row33 = pds.Rows[i][32].ToString().Trim();
                    if (!string.IsNullOrEmpty(row33))
                    {
                        try
                        {
                            Int32 equipmentNum = Convert.ToInt32(row33);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "机械设备起数" + "," + "[" + row33 + "]错误!" + "|";
                        }
                    }
                    string row34 = pds.Rows[i][33].ToString().Trim();
                    if (!string.IsNullOrEmpty(row34))
                    {
                        try
                        {
                            Int32 qualityNum = Convert.ToInt32(row34);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "质量起数" + "," + "[" + row34 + "]错误!" + "|";
                        }
                    }
                    string row35 = pds.Rows[i][34].ToString().Trim();
                    if (!string.IsNullOrEmpty(row35))
                    {
                        try
                        {
                            Int32 otherNum = Convert.ToInt32(row35);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "其它起数" + "," + "[" + row35 + "]错误!" + "|";
                        }
                    }
                    string row36 = pds.Rows[i][35].ToString().Trim();
                    if (!string.IsNullOrEmpty(row36))
                    {
                        try
                        {
                            Int32 firstAidDressingsNum = Convert.ToInt32(row36);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "急救包扎起数" + "," + "[" + row36 + "]错误!" + "|";
                        }
                    }
                    string row37 = pds.Rows[i][36].ToString().Trim();
                    if (!string.IsNullOrEmpty(row37))
                    {
                        try
                        {
                            Int32 attemptedEventNum = Convert.ToInt32(row37);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "未遂事件起数" + "," + "[" + row37 + "]错误!" + "|";
                        }
                    }
                    string row38 = pds.Rows[i][37].ToString().Trim();
                    if (!string.IsNullOrEmpty(row38))
                    {
                        try
                        {
                            Int32 lossDayNum = Convert.ToInt32(row38);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "损失工日" + "," + "[" + row38 + "]错误!" + "|";
                        }
                    }
                }
                if (!string.IsNullOrEmpty(result))
                {
                    result = result.Substring(0, result.LastIndexOf("|"));
                    ShowNotify(result, MessageBoxIcon.Warning);
                    //Session["errorInfos"] = result;
                }
                else
                {
                    ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
                }
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            }
            else
            {
                ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
            }
            return(true);
        }
예제 #2
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            var updateCost = BLL.HSSECostUnitManageService.GetHSSECostUnitManageByHSSECostUnitManageId(this.HSSECostUnitManageId);

            if (updateCost != null)
            {
                updateCost.CostA1      = Funs.GetNewDecimalOrZero(this.txtA1.Text.Trim());
                updateCost.CostA2      = Funs.GetNewDecimalOrZero(this.txtA2.Text.Trim());
                updateCost.CostA3      = Funs.GetNewDecimalOrZero(this.txtA3.Text.Trim());
                updateCost.CostA4      = Funs.GetNewDecimalOrZero(this.txtA4.Text.Trim());
                updateCost.CostA5      = Funs.GetNewDecimalOrZero(this.txtA5.Text.Trim());
                updateCost.CostA6      = Funs.GetNewDecimalOrZero(this.txtA6.Text.Trim());
                updateCost.CostA7      = Funs.GetNewDecimalOrZero(this.txtA7.Text.Trim());
                updateCost.CostA8      = Funs.GetNewDecimalOrZero(this.txtA8.Text.Trim());
                updateCost.CostB1      = Funs.GetNewDecimalOrZero(this.txtB1.Text.Trim());
                updateCost.CostB2      = Funs.GetNewDecimalOrZero(this.txtB2.Text.Trim());
                updateCost.CostC1      = Funs.GetNewDecimalOrZero(this.txtC1.Text.Trim());
                updateCost.CostD1      = Funs.GetNewDecimalOrZero(this.txtD1.Text.Trim());
                updateCost.CostD2      = Funs.GetNewDecimalOrZero(this.txtD2.Text.Trim());
                updateCost.CostD3      = Funs.GetNewDecimalOrZero(this.txtD3.Text.Trim());
                updateCost.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text);

                updateCost.AuditCostA1 = Funs.GetNewDecimalOrZero(this.txtA1.Text.Trim());
                updateCost.AuditCostA2 = Funs.GetNewDecimalOrZero(this.txtA2.Text.Trim());
                updateCost.AuditCostA3 = Funs.GetNewDecimalOrZero(this.txtA3.Text.Trim());
                updateCost.AuditCostA4 = Funs.GetNewDecimalOrZero(this.txtA4.Text.Trim());
                updateCost.AuditCostA5 = Funs.GetNewDecimalOrZero(this.txtA5.Text.Trim());
                updateCost.AuditCostA6 = Funs.GetNewDecimalOrZero(this.txtA6.Text.Trim());
                updateCost.AuditCostA7 = Funs.GetNewDecimalOrZero(this.txtA7.Text.Trim());
                updateCost.AuditCostA8 = Funs.GetNewDecimalOrZero(this.txtA8.Text.Trim());

                updateCost.AuditedSubUnitCost = (updateCost.CostA1 + updateCost.CostA2 + updateCost.CostA3 + updateCost.CostA4 + updateCost.CostA5
                                                 + updateCost.CostA6 + updateCost.CostA7 + updateCost.CostA8) / 10000;

                updateCost.SubUnitCost = updateCost.AuditedSubUnitCost;
                if (this.drpAuditManId.SelectedValue != BLL.Const._Null)
                {
                    updateCost.AuditManId = this.drpAuditManId.SelectedValue;
                }

                ////单据状态
                updateCost.States = BLL.Const.State_0;
                if (type == BLL.Const.BtnSubmit)
                {
                    updateCost.States    = BLL.Const.State_2;
                    updateCost.StateType = "2";

                    Model.Sys_FlowOperate newNextFlowOperate = new Model.Sys_FlowOperate
                    {
                        FlowOperateId = SQLHelper.GetNewID(typeof(Model.Sys_FlowOperate)),
                        MenuId        = BLL.Const.ProjectHSSECostUnitManageAuditMenuId,
                        DataId        = this.HSSECostUnitManageId + "#2",
                        ProjectId     = this.ProjectId,
                        Url           = "../CostGoods/HSSECostUnitManageAuditView.aspx?HSSECostUnitManageId={0}",
                        SortIndex     = 1,
                        OperaterTime  = System.DateTime.Now,
                        OperaterId    = this.drpAuditManId.SelectedValue,
                        AuditFlowName = "安全工程师审核",
                        IsClosed      = false,
                        State         = BLL.Const.State_1,
                    };
                    Funs.DB.Sys_FlowOperate.InsertOnSubmit(newNextFlowOperate);
                    Funs.DB.SubmitChanges();
                }
                BLL.HSSECostUnitManageService.UpdateHSSECostUnitManage(updateCost);

                ////保存流程审核数据
                this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectHSSECostUnitManageMenuId, this.HSSECostUnitManageId, (type == BLL.Const.BtnSubmit ? true : false),
                                              BLL.UnitService.GetUnitNameByUnitId(updateCost.UnitId) + "费用上报", "../CostGoods/HSSECostUnitManageView.aspx?HSSECostUnitManageId={0}");

                if (type == BLL.Const.BtnSubmit)
                {
                    var updateNoClosedFlowOperate = from x in Funs.DB.Sys_FlowOperate
                                                    where x.DataId == this.HSSECostUnitManageId && (x.IsClosed == false || !x.IsClosed.HasValue)
                                                    select x;
                    if (updateNoClosedFlowOperate.Count() > 0)
                    {
                        foreach (var itemClosed in updateNoClosedFlowOperate)
                        {
                            itemClosed.OperaterId = this.CurrUser.UserId;
                            itemClosed.IsClosed   = true;
                            Funs.DB.SubmitChanges();
                        }
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            Model.CostGoods_CostSmallDetail costSmallDetail = new Model.CostGoods_CostSmallDetail
            {
                ProjectId = this.ProjectId
            };
            //if (!string.IsNullOrEmpty(this.txtMonths.Text))
            //{
            //    costSmallDetail.Months = Funs.GetNewDateTime(this.txtMonths.Text + "-01");
            //}
            if (this.drpYear.SelectedValue != BLL.Const._Null && this.drpMonths.SelectedValue != BLL.Const._Null)
            {
                costSmallDetail.Months = Funs.GetNewDateTime(this.drpYear.SelectedValue + "-" + this.drpMonths.SelectedValue);
            }
            costSmallDetail.CostSmallDetailCode = this.txtCostSmallDetailCode.Text.Trim();
            if (this.drpUnitId.SelectedValue != BLL.Const._Null)
            {
                costSmallDetail.UnitId = this.drpUnitId.SelectedValue;
            }
            costSmallDetail.ReportDate = Funs.GetNewDateTime(this.txtReportDate.Text.Trim());

            //costSmallDetail.CheckMan = this.txtCheckMan.Text;
            //costSmallDetail.CheckDate = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim());
            //costSmallDetail.ApproveMan = this.txtApproveMan.Text;
            //costSmallDetail.ApproveDate = Funs.GetNewDateTime(this.txtApproveDate.Text.Trim());
            costSmallDetail.States = BLL.Const.State_0;
            if (type == BLL.Const.BtnSubmit)
            {
                costSmallDetail.States = this.ctlAuditFlow.NextStep;
            }
            if (!string.IsNullOrEmpty(this.CostSmallDetailId))
            {
                costSmallDetail.CostSmallDetailId = this.CostSmallDetailId;
                BLL.CostSmallDetailService.UpdateCostSmallDetail(costSmallDetail);
                BLL.LogService.AddSys_Log(this.CurrUser, costSmallDetail.CostSmallDetailCode, costSmallDetail.CostSmallDetailId, BLL.Const.ProjectCostSmallDetailMenuId, BLL.Const.BtnModify);
                BLL.CostSmallDetailItemService.DeleteCostSmallDetailItemByCostSmallDetailId(this.CostSmallDetailId);
            }
            else
            {
                this.CostSmallDetailId            = SQLHelper.GetNewID(typeof(Model.CostGoods_CostSmallDetail));
                costSmallDetail.CostSmallDetailId = this.CostSmallDetailId;
                //costSmallDetail.CompileMan = this.CurrUser.UserName;
                costSmallDetail.CompileDate = DateTime.Now;
                BLL.CostSmallDetailService.AddCostSmallDetail(costSmallDetail);
                BLL.LogService.AddSys_Log(this.CurrUser, costSmallDetail.CostSmallDetailCode, costSmallDetail.CostSmallDetailId, BLL.Const.ProjectCostSmallDetailMenuId, BLL.Const.BtnAdd);
            }
            //保存费用明细
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "A1", Funs.GetNewDecimalOrZero(this.nbA1.Text), this.txtDefA1.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "A2", Funs.GetNewDecimalOrZero(this.nbA2.Text), this.txtDefA2.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "A3", Funs.GetNewDecimalOrZero(this.nbA3.Text), this.txtDefA3.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "A4", Funs.GetNewDecimalOrZero(this.nbA4.Text), this.txtDefA4.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "A5", Funs.GetNewDecimalOrZero(this.nbA5.Text), this.txtDefA5.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "A6", Funs.GetNewDecimalOrZero(this.nbA6.Text), this.txtDefA6.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "B1", Funs.GetNewDecimalOrZero(this.nbB1.Text), this.txtDefB1.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "B2", Funs.GetNewDecimalOrZero(this.nbB2.Text), this.txtDefB2.Text.Trim());
            BLL.CostSmallDetailItemService.AddCostDetail(costSmallDetail.CostSmallDetailId, "B3", Funs.GetNewDecimalOrZero(this.nbB3.Text), this.txtDefB3.Text.Trim());
            ////保存流程审核数据
            this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectCostSmallDetailMenuId, this.CostSmallDetailId, (type == BLL.Const.BtnSubmit ? true : false), costSmallDetail.CostSmallDetailCode, "../CostGoods/CostSmallDetailView.aspx?CostSmallDetailId={0}");
        }
예제 #4
0
        /// <summary>
        /// 加载页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
                this.ProjectId = this.CurrUser.LoginProjectId;
                this.InitDropDownList();
                this.RectifyNoticeId = Request.Params["RectifyNoticeId"];
                string states = Request.Params["states"];
                if (!string.IsNullOrEmpty(this.RectifyNoticeId) && this.RectifyNoticeId.Contains("$"))
                {
                    List <string> stre = Funs.GetStrListByStr(this.RectifyNoticeId, '$');
                    if (stre.Count > 0)
                    {
                        this.RectifyNoticeId = stre[0];
                        states = stre[1];
                    }
                }
                if (!string.IsNullOrEmpty(states))
                {
                    this.drpIsRectify.Hidden   = false;
                    this.drpCheckPerson.Hidden = false;
                    this.txtReCheckDate.Hidden = false;
                }

                var rectifyNotice = BLL.RectifyNoticesService.GetRectifyNoticesById(this.RectifyNoticeId);
                if (rectifyNotice != null)
                {
                    this.ProjectId = rectifyNotice.ProjectId;
                    if (this.ProjectId != this.CurrUser.LoginProjectId)
                    {
                        this.InitDropDownList();
                    }
                    //隐患
                    this.txtRectifyNoticesCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.RectifyNoticeId);
                    if (!string.IsNullOrEmpty(rectifyNotice.UnitId))
                    {
                        this.drpUnitId.SelectedValue = rectifyNotice.UnitId;
                        BLL.UserService.InitUserProjectIdUnitIdDropDownList(this.drpDutyPerson, this.ProjectId, this.drpUnitId.SelectedValue, true);
                        if (!string.IsNullOrEmpty(rectifyNotice.DutyPersonId))
                        {
                            this.drpDutyPerson.SelectedValue = rectifyNotice.DutyPersonId;
                        }
                    }
                    if (!string.IsNullOrEmpty(rectifyNotice.WorkAreaId))
                    {
                        this.drpWorkAreaId.SelectedValue = rectifyNotice.WorkAreaId;
                    }
                    if (rectifyNotice.CheckedDate != null)
                    {
                        this.txtCheckedDate.Text = string.Format("{0:yyyy-MM-dd}", rectifyNotice.CheckedDate);
                    }
                    if (!string.IsNullOrEmpty(rectifyNotice.WrongContent))
                    {
                        this.txtWrongContent.Text = rectifyNotice.WrongContent;
                    }
                    else
                    {
                        this.txtWrongContent.Text = "隐患问题及整改要求:";
                    }
                    if (!string.IsNullOrEmpty(rectifyNotice.SignPerson))
                    {
                        this.drpSignPerson.SelectedValue = rectifyNotice.SignPerson;
                    }
                    if (rectifyNotice.SignDate != null)
                    {
                        this.txtSignDate.Text = string.Format("{0:yyyy-MM-dd}", rectifyNotice.SignDate);
                    }
                    if (!string.IsNullOrEmpty(rectifyNotice.CompleteStatus))
                    {
                        this.txtCompleteStatus.Text = rectifyNotice.CompleteStatus;
                    }
                    else
                    {
                        this.txtCompleteStatus.Text = "整改结果:";
                    }
                    this.txtDutyPerson.Text   = rectifyNotice.DutyPerson;
                    this.txtCompleteDate.Text = string.Format("{0:yyyy-MM-dd}", rectifyNotice.CompleteDate);

                    this.drpIsRectify.SelectedValue = Convert.ToString(rectifyNotice.IsRectify);
                    if (!string.IsNullOrEmpty(rectifyNotice.CheckPerson))
                    {
                        this.drpCheckPerson.SelectedValue = rectifyNotice.CheckPerson;
                    }
                    else
                    {
                        this.drpCheckPerson.SelectedValue = Const._Null;
                    }
                    this.txtReCheckDate.Text = string.Format("{0:yyyy-MM-dd}", rectifyNotice.ReCheckDate);
                }
                else
                {
                    ////自动生成编码
                    this.txtRectifyNoticesCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectRectifyNoticeMenuId, this.ProjectId, this.CurrUser.UnitId);
                    if (this.CurrUser.UserId != BLL.Const.sysglyId)
                    {
                        this.drpSignPerson.SelectedValue = this.CurrUser.UserId;
                    }

                    //this.txtCheckedDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
                    this.txtSignDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
                    // this.txtCompleteDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
                    this.txtWrongContent.Text   = "隐患描述:";
                    this.txtCompleteStatus.Text = "整改结果:";
                }
            }
        }
예제 #5
0
        public static void AutoCode(List <string> classes)
        {
            // 自动生成所有需要委托
            SortedDictionary <string, Funs> allfuns = new SortedDictionary <string, Funs>(); // 所有的需要导出的函数原形列表

            var flag = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.DeclaredOnly;
            var alls = new List <System.Type>();

            HashSet <int>    ObjectsParamCount = new HashSet <int>();
            HashSet <string> exports           = new HashSet <string>(classes);
            {
                var assembly = Assembly.Load("Assembly-CSharp");
                var types    = assembly.GetTypes();
                foreach (var type in types)
                {
                    if (exports.Contains(type.FullName.Replace('+', '/')) || type.GetCustomAttributes(typeof(HotfixAttribute), false).Length != 0)
                    {
                        //wxb.L.LogFormat("type:{0}", type.FullName);
                        if (type.IsGenericType)
                        {
                            continue;
                        }

                        foreach (var method in type.GetMethods(flag))
                        {
                            if (method.IsGenericMethod)
                            {
                                continue;
                            }

                            if (IsEditorAttribute(method))
                            {
                                continue;
                            }

                            Funs fun = new Funs(method, method.IsStatic ? false : true);
                            if (!fun.isExport)
                            {
                                continue;
                            }

                            string key = fun.oid;
                            Funs   rs;
                            if (allfuns.TryGetValue(key, out rs))
                            {
                                rs.methods.Add(method);
                                continue;
                            }

                            allfuns.Add(key, fun);
                        }

                        // MonoBehaviour类型不重载构造函数
                        if (IsUnityObjectType(type))
                        {
                            continue;
                        }

                        foreach (var ctor in type.GetConstructors(flag))
                        {
                            if (ctor.IsGenericMethod)
                            {
                                continue;
                            }

                            if (IsEditorAttribute(ctor))
                            {
                                continue;
                            }

                            Funs fun = new Funs(ctor, ctor.IsStatic ? false : true);
                            if (!fun.isExport)
                            {
                                continue;
                            }

                            string key = fun.oid;
                            Funs   rs;
                            if (allfuns.TryGetValue(key, out rs))
                            {
                                rs.methods.Add(ctor);
                                continue;
                            }

                            allfuns.Add(key, fun);
                        }
                    }
                }
            }

            string marco, suffix;

            AutoRegILType.GetPlatform(out marco, out suffix);
            string file = string.Format("Assets/XIL/Auto/GenDelegateBridge_{0}.cs", suffix);

            System.IO.Directory.CreateDirectory(file.Substring(0, file.LastIndexOf('/')));

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            string name  = "__Gen_Delegate_Imp";
            int    index = 0;

            foreach (var ator in allfuns)
            {
                ator.Value.toInfo("        ", sb);
                int paramCount = 0;
                sb.AppendFormat("        {0}", ator.Value.toString(name + (++index), out paramCount));
                sb.AppendLine();
                if (paramCount != 0)
                {
                    ObjectsParamCount.Add(paramCount);
                }
            }

            System.IO.File.WriteAllText(file, string.Format(file_format + "#endif", marco, sb.ToString()));
            wxb.L.LogFormat("count:{0}", allfuns.Count);

            sb.Length = 0;
            sb.AppendLine(string.Format("countType:{0}", classes.Count));
            foreach (var ator in classes)
            {
                sb.AppendLine(ator);
            }
            wxb.L.LogFormat(sb.ToString());

            GeneratorObjects.Gen(ObjectsParamCount);
            AssetDatabase.Refresh();
        }
예제 #6
0
        /// <summary>
        /// 将Dataset的数据导入数据库
        /// </summary>
        /// <param name="pds">数据集</param>
        /// <param name="Cols">数据集行数</param>
        /// <returns></returns>
        private bool AddDatasetToSQL(DataTable pds)
        {
            string results = string.Empty;
            int    ir      = pds.Rows.Count;

            if (pds != null && ir > 0)
            {
                var getCheckSpecial = BLL.Check_CheckSpecialService.GetCheckSpecialByCheckSpecialId(this.CheckSpecialId);
                if (getCheckSpecial != null)
                {
                    var units     = from x in Funs.DB.Base_Unit select x;
                    var sysConsts = from x in Funs.DB.Sys_Const
                                    where x.GroupId == BLL.ConstValue.Group_HandleStep
                                    select x;
                    var supCheckSets = from x in Funs.DB.Check_ProjectCheckItemSet
                                       where x.ProjectId == this.CurrUser.LoginProjectId && x.SupCheckItem == "0" && x.CheckType == "2"
                                       select x;
                    for (int i = 0; i < ir; i++)
                    {
                        string result = string.Empty;
                        string col0   = pds.Rows[i][0].ToString().Trim();
                        string col1   = pds.Rows[i][1].ToString().Trim();
                        string col2   = pds.Rows[i][2].ToString().Trim();
                        string col3   = pds.Rows[i][3].ToString().Trim();
                        string col4   = pds.Rows[i][4].ToString().Trim();
                        string col5   = pds.Rows[i][5].ToString().Trim();
                        string col6   = pds.Rows[i][6].ToString().Trim();
                        string col7   = pds.Rows[i][7].ToString().Trim();
                        string col8   = pds.Rows[i][8].ToString().Trim();

                        if (!string.IsNullOrEmpty(col0) || !string.IsNullOrEmpty(col1))
                        {
                            if (string.IsNullOrEmpty(col4) || string.IsNullOrEmpty(col5) || string.IsNullOrEmpty(col6))
                            {
                                result += "第" + (i + 2).ToString() + "行," + "必填项为空!" + "|";
                            }
                            else
                            {
                                Model.View_Check_CheckSpecialDetail newViewDetail = new Model.View_Check_CheckSpecialDetail
                                {
                                    CheckSpecialDetailId = SQLHelper.GetNewID(typeof(Model.View_EduTrain_TrainRecordDetail)),
                                    CheckSpecialId       = getCheckSpecial.CheckSpecialId,
                                    CheckContent         = col1,
                                    Unqualified          = col2,
                                    Suggestions          = col3,
                                    WorkArea             = col4,
                                    LimitedDate          = Funs.GetNewDateTime(col7),
                                };

                                var checkName = supCheckSets.FirstOrDefault(x => x.CheckItemName == col0);
                                if (checkName != null)
                                {
                                    newViewDetail.CheckItem    = checkName.CheckItemSetId;
                                    newViewDetail.CheckItemStr = checkName.CheckItemName;
                                }
                                else
                                {
                                    result += "第" + (i + 2).ToString() + "行," + "项目检查项中不存在!" + "|";
                                }

                                var unit = units.FirstOrDefault(x => x.UnitName == col5);
                                if (unit != null)
                                {
                                    newViewDetail.UnitId   = unit.UnitId;
                                    newViewDetail.UnitName = unit.UnitName;
                                }
                                else
                                {
                                    result += "第" + (i + 2).ToString() + "行," + "单位表中不存在!" + "|";
                                }

                                var sysConst = sysConsts.FirstOrDefault(x => x.ConstText == col6);
                                if (sysConst != null)
                                {
                                    newViewDetail.HandleStepStr = sysConst.ConstText;
                                    newViewDetail.HandleStep    = sysConst.ConstValue;
                                }
                                else
                                {
                                    result += "第" + (i + 2).ToString() + "行," + "常量表中不存在!" + "|";
                                }

                                newViewDetail.CompleteStatusName = col8;
                                if (col8 == "是")
                                {
                                    newViewDetail.CompleteStatus = true;
                                }
                                else
                                {
                                    newViewDetail.CompleteStatus = false;
                                }

                                ///判断是否已存在
                                var addItem = Funs.DB.Check_CheckSpecialDetail.FirstOrDefault(x => x.CheckSpecialId == newViewDetail.CheckSpecialId && x.CheckContent == newViewDetail.CheckContent &&
                                                                                              x.CheckItem == newViewDetail.CheckItem && x.WorkArea == newViewDetail.WorkArea && x.UnitId == newViewDetail.UnitId);
                                if (addItem == null)
                                {
                                    if (string.IsNullOrEmpty(result))
                                    {
                                        Model.Check_CheckSpecialDetail newDetail = new Model.Check_CheckSpecialDetail
                                        {
                                            CheckSpecialDetailId = newViewDetail.CheckSpecialDetailId,
                                            CheckSpecialId       = newViewDetail.CheckSpecialId,
                                            CheckItem            = newViewDetail.CheckItem,
                                            Unqualified          = newViewDetail.Unqualified,
                                            UnitId         = newViewDetail.UnitId,
                                            HandleStep     = newViewDetail.HandleStep,
                                            CompleteStatus = newViewDetail.CompleteStatus,
                                            LimitedDate    = newViewDetail.LimitedDate,
                                            Suggestions    = newViewDetail.Suggestions,
                                            CheckContent   = newViewDetail.CheckContent,
                                            WorkArea       = newViewDetail.WorkArea,
                                        };

                                        BLL.Check_CheckSpecialDetailService.AddCheckSpecialDetail(newDetail);
                                        ///加入
                                        viewDetails.Add(newViewDetail);
                                    }
                                }
                                else
                                {
                                    result += "第" + (i + 2).ToString() + "行," + "导入数据重复" + "|";
                                }


                                if (!string.IsNullOrEmpty(result))
                                {
                                    results += result;
                                }
                            }
                        }
                    }
                    if (viewDetails.Count > 0)
                    {
                        viewDetails           = viewDetails.Distinct().ToList();
                        this.Grid1.Hidden     = false;
                        this.Grid1.DataSource = viewDetails;
                        this.Grid1.DataBind();
                    }

                    if (!string.IsNullOrEmpty(results))
                    {
                        viewDetails.Clear();
                        results    = "数据导入完成,未成功数据:" + results.Substring(0, results.LastIndexOf("|"));
                        errorInfos = results;
                        Alert alert = new Alert
                        {
                            Message = results,
                            Target  = Target.Self
                        };
                        alert.Show();
                    }
                    else
                    {
                        errorInfos = string.Empty;
                        ShowNotify("导入成功!", MessageBoxIcon.Success);
                        PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    }
                }
                else
                {
                    Alert.ShowInTop("培训数据为空!", MessageBoxIcon.Warning);
                }
            }
            else
            {
                Alert.ShowInTop("导入数据为空!", MessageBoxIcon.Warning);
            }

            BLL.UploadFileService.DeleteFile(Funs.RootPath, initPath + this.hdFileName.Text);
            return(true);
        }
예제 #7
0
        /// <summary>
        /// 加载页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnClose.OnClientClick = ActiveWindow.GetHideReference();

                this.CostSmallDetailId = Request.Params["CostSmallDetailId"];
                if (!string.IsNullOrEmpty(this.CostSmallDetailId))
                {
                    Model.CostGoods_CostSmallDetail costSmallDetail = BLL.CostSmallDetailService.GetCostSmallDetailById(this.CostSmallDetailId);
                    if (costSmallDetail != null)
                    {
                        this.txtCostSmallDetailCode.Text = CodeRecordsService.ReturnCodeByDataId(this.CostSmallDetailId);
                        if (costSmallDetail.Months != null)
                        {
                            this.txtMonths.Text = string.Format("{0:yyyy-MM}", costSmallDetail.Months);
                        }
                        if (!string.IsNullOrEmpty(costSmallDetail.UnitId))
                        {
                            Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(costSmallDetail.UnitId);
                            if (unit != null)
                            {
                                this.drpUnitId.Text = unit.UnitName;
                            }
                        }
                        if (costSmallDetail.ReportDate != null)
                        {
                            this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", costSmallDetail.ReportDate);
                        }
                        //this.txtCompileMan.Text = costSmallDetail.CompileMan;
                        //if (costSmallDetail.CompileDate != null)
                        //{
                        //    this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", costSmallDetail.CompileDate);
                        //}
                        //this.txtCheckMan.Text = costSmallDetail.CheckMan;
                        //if (costSmallDetail.CheckDate != null)
                        //{
                        //    this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", costSmallDetail.CheckDate);
                        //}
                        //this.txtApproveMan.Text = costSmallDetail.ApproveMan;
                        //if (costSmallDetail.ApproveDate != null)
                        //{
                        //    this.txtApproveDate.Text = string.Format("{0:yyyy-MM-dd}", costSmallDetail.ApproveDate);
                        //}
                        decimal            totalA = 0, totalB = 0, totalProjectA = 0, totalProjectB = 0;
                        Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(costSmallDetail.ProjectId);
                        if (project != null && costSmallDetail.Months.HasValue)
                        {
                            List <Model.CostGoods_CostSmallDetailItem> projectDetails = BLL.CostSmallDetailItemService.GetCostDetailsByUnitId(this.CurrUser.LoginProjectId, costSmallDetail.UnitId, project.StartDate, costSmallDetail.Months);
                            List <Model.CostGoods_CostSmallDetailItem> details        = BLL.CostSmallDetailItemService.GetCostSmallDetailItemByCostSmallDetailId(this.CostSmallDetailId);
                            Model.CostGoods_CostSmallDetailItem        a1             = details.FirstOrDefault(x => x.CostType == "A1");
                            if (a1 != null)
                            {
                                this.nbA1.Text        = (a1.CostMoney ?? 0).ToString();
                                totalA               += Funs.GetNewDecimalOrZero(this.nbA1.Text);
                                this.nbProjectA1.Text = ((from x in projectDetails where x.CostType == "A1" select x.CostMoney ?? 0).Sum() + a1.CostMoney ?? 0).ToString();
                                totalProjectA        += Funs.GetNewDecimalOrZero(this.nbProjectA1.Text);
                                this.txtDefA1.Text    = a1.CostDef;
                            }
                            Model.CostGoods_CostSmallDetailItem a2 = details.FirstOrDefault(x => x.CostType == "A2");
                            if (a2 != null)
                            {
                                this.nbA2.Text        = (a2.CostMoney ?? 0).ToString();
                                totalA               += Funs.GetNewDecimalOrZero(this.nbA2.Text);
                                this.nbProjectA2.Text = ((from x in projectDetails where x.CostType == "A2" select x.CostMoney ?? 0).Sum() + a2.CostMoney ?? 0).ToString();
                                totalProjectA        += Funs.GetNewDecimalOrZero(this.nbProjectA2.Text);
                                this.txtDefA2.Text    = a2.CostDef;
                            }
                            Model.CostGoods_CostSmallDetailItem a3 = details.FirstOrDefault(x => x.CostType == "A3");
                            if (a3 != null)
                            {
                                this.nbA3.Text        = (a3.CostMoney ?? 0).ToString();
                                totalA               += Funs.GetNewDecimalOrZero(this.nbA3.Text);
                                this.nbProjectA3.Text = ((from x in projectDetails where x.CostType == "A3" select x.CostMoney ?? 0).Sum() + a3.CostMoney ?? 0).ToString();
                                totalProjectA        += Funs.GetNewDecimalOrZero(this.nbProjectA3.Text);
                                this.txtDefA3.Text    = a3.CostDef;
                            }
                            Model.CostGoods_CostSmallDetailItem a4 = details.FirstOrDefault(x => x.CostType == "A4");
                            if (a4 != null)
                            {
                                this.nbA4.Text        = (a4.CostMoney ?? 0).ToString();
                                totalA               += Funs.GetNewDecimalOrZero(this.nbA4.Text);
                                this.nbProjectA4.Text = ((from x in projectDetails where x.CostType == "A4" select x.CostMoney ?? 0).Sum() + a4.CostMoney ?? 0).ToString();
                                totalProjectA        += Funs.GetNewDecimalOrZero(this.nbProjectA4.Text);
                                this.txtDefA4.Text    = a4.CostDef;
                            }
                            Model.CostGoods_CostSmallDetailItem a5 = details.FirstOrDefault(x => x.CostType == "A5");
                            if (a5 != null)
                            {
                                this.nbA5.Text        = (a5.CostMoney ?? 0).ToString();
                                totalA               += Funs.GetNewDecimalOrZero(this.nbA5.Text);
                                this.nbProjectA5.Text = ((from x in projectDetails where x.CostType == "A5" select x.CostMoney ?? 0).Sum() + a5.CostMoney ?? 0).ToString();
                                totalProjectA        += Funs.GetNewDecimalOrZero(this.nbProjectA5.Text);
                                this.txtDefA5.Text    = a5.CostDef;
                            }
                            Model.CostGoods_CostSmallDetailItem a6 = details.FirstOrDefault(x => x.CostType == "A6");
                            if (a6 != null)
                            {
                                this.nbA6.Text        = (a6.CostMoney ?? 0).ToString();
                                totalA               += Funs.GetNewDecimalOrZero(this.nbA6.Text);
                                this.nbProjectA6.Text = ((from x in projectDetails where x.CostType == "A6" select x.CostMoney ?? 0).Sum() + a6.CostMoney ?? 0).ToString();
                                totalProjectA        += Funs.GetNewDecimalOrZero(this.nbProjectA6.Text);
                                this.txtDefA6.Text    = a6.CostDef;
                            }
                            this.nbA.Text        = totalA.ToString();
                            this.nbProjectA.Text = totalProjectA.ToString();
                            Model.CostGoods_CostSmallDetailItem b1 = details.FirstOrDefault(x => x.CostType == "B1");
                            if (b1 != null)
                            {
                                this.nbB1.Text        = (b1.CostMoney ?? 0).ToString();
                                totalB               += Funs.GetNewDecimalOrZero(this.nbB1.Text);
                                this.nbProjectB1.Text = ((from x in projectDetails where x.CostType == "B1" select x.CostMoney ?? 0).Sum() + b1.CostMoney ?? 0).ToString();
                                totalProjectB        += Funs.GetNewDecimalOrZero(this.nbProjectB1.Text);
                                this.txtDefB1.Text    = b1.CostDef;
                            }
                            Model.CostGoods_CostSmallDetailItem b2 = details.FirstOrDefault(x => x.CostType == "B2");
                            if (b2 != null)
                            {
                                this.nbB2.Text        = (b2.CostMoney ?? 0).ToString();
                                totalB               += Funs.GetNewDecimalOrZero(this.nbB2.Text);
                                this.nbProjectB2.Text = ((from x in projectDetails where x.CostType == "B2" select x.CostMoney ?? 0).Sum() + b2.CostMoney ?? 0).ToString();
                                totalProjectB        += Funs.GetNewDecimalOrZero(this.nbProjectB2.Text);
                                this.txtDefB2.Text    = b2.CostDef;
                            }
                            Model.CostGoods_CostSmallDetailItem b3 = details.FirstOrDefault(x => x.CostType == "B3");
                            if (b3 != null)
                            {
                                this.nbB3.Text        = (b3.CostMoney ?? 0).ToString();
                                totalB               += Funs.GetNewDecimalOrZero(this.nbB3.Text);
                                this.nbProjectB3.Text = ((from x in projectDetails where x.CostType == "B3" select x.CostMoney ?? 0).Sum() + b3.CostMoney ?? 0).ToString();
                                totalProjectB        += Funs.GetNewDecimalOrZero(this.nbProjectB3.Text);
                                this.txtDefB3.Text    = b3.CostDef;
                            }
                            this.nbB.Text         = totalB.ToString();
                            this.nbProjectB.Text  = totalProjectB.ToString();
                            this.nbAB.Text        = (totalA + totalB).ToString();
                            this.nbProjectAB.Text = (totalProjectA + totalProjectB).ToString();
                        }
                    }
                    ///初始化审核菜单
                    this.ctlAuditFlow.MenuId = BLL.Const.ProjectCostSmallDetailMenuId;
                    this.ctlAuditFlow.DataId = this.CostSmallDetailId;
                }
            }
        }
예제 #8
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            Model.Check_CheckWork checkWork = new Model.Check_CheckWork
            {
                CheckWorkCode = this.txtCheckWorkCode.Text.Trim(),
                CheckTime     = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim()),
                ProjectId     = this.ProjectId,
                Area          = this.txtArea.Text.Trim()
            };
            if (!string.IsNullOrEmpty(this.drpThisUnit.SelectedValue))
            {
                checkWork.ThisUnitId = this.drpThisUnit.SelectedValue;
            }
            //本单位人员
            string mainUnitPerson = string.Empty;

            foreach (var item in this.drpMainUnitPerson.SelectedValueArray)
            {
                mainUnitPerson += item + ",";
            }
            if (!string.IsNullOrEmpty(mainUnitPerson))
            {
                mainUnitPerson = mainUnitPerson.Substring(0, mainUnitPerson.LastIndexOf(","));
            }
            checkWork.MainUnitPerson = mainUnitPerson;
            //参与单位
            string subUnits = string.Empty;

            foreach (var item in this.drpSubUnits.SelectedValueArray)
            {
                subUnits += item + ",";
            }
            if (!string.IsNullOrEmpty(subUnits))
            {
                checkWork.SubUnits = subUnits.Substring(0, subUnits.LastIndexOf(","));
            }

            //参与用户
            string subUnitPerson = string.Empty;

            foreach (var item in this.drpSubUnitPerson.SelectedValueArray)
            {
                if (item != BLL.Const._Null)
                {
                    subUnitPerson += item + ",";
                }
            }
            if (!string.IsNullOrEmpty(subUnitPerson))
            {
                checkWork.SubUnitPerson = subUnitPerson.Substring(0, subUnitPerson.LastIndexOf(","));
            }
            checkWork.PartInPersonNames = this.txtPartInPersonNames.Text.Trim();
            if (this.ckIsAgree.Checked)
            {
                checkWork.IsAgree = true;
            }
            checkWork.MainUnitDeputy     = this.txtMainUnitDeputy.Text.Trim();
            checkWork.MainUnitDeputyDate = Funs.GetNewDateTime(this.txtMainUnitDeputyDate.Text.Trim());
            checkWork.SubUnitDeputy      = this.txtSubUnitDeputy.Text.Trim();
            checkWork.SubUnitDeputyDate  = Funs.GetNewDateTime(this.txtSubUnitDeputyDate.Text.Trim());
            ////单据状态
            checkWork.States = BLL.Const.State_0;
            if (type == BLL.Const.BtnSubmit)
            {
                checkWork.States = this.ctlAuditFlow.NextStep;
            }
            if (!string.IsNullOrEmpty(this.CheckWorkId))
            {
                checkWork.CheckWorkId = this.CheckWorkId;
                BLL.Check_CheckWorkService.UpdateCheckWork(checkWork);
                BLL.LogService.AddSys_Log(this.CurrUser, checkWork.CheckWorkCode, checkWork.CheckWorkId, BLL.Const.ProjectCheckWorkMenuId, BLL.Const.BtnAdd);
            }
            else
            {
                checkWork.CheckWorkId = SQLHelper.GetNewID(typeof(Model.Check_CheckWork));
                checkWork.CompileMan  = this.CurrUser.UserId;
                this.CheckWorkId      = checkWork.CheckWorkId;
                BLL.Check_CheckWorkService.AddCheckWork(checkWork);
                BLL.LogService.AddSys_Log(this.CurrUser, checkWork.CheckWorkCode, checkWork.CheckWorkId, BLL.Const.ProjectCheckWorkMenuId, BLL.Const.BtnModify);
            }
            ////保存流程审核数据
            this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectCheckWorkMenuId, this.CheckWorkId, (type == BLL.Const.BtnSubmit ? true : false), checkWork.Area, "../Check/CheckWorkView.aspx?CheckWorkId={0}");
        }
예제 #9
0
 /// <summary>
 /// 加载页面
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.ProjectId = this.CurrUser.LoginProjectId;
         this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
         this.hdProjectA1.Text       = "0";
         this.hdProjectA2.Text       = "0";
         this.hdProjectA3.Text       = "0";
         this.hdProjectA4.Text       = "0";
         this.hdProjectA5.Text       = "0";
         this.hdProjectA6.Text       = "0";
         this.hdProjectB1.Text       = "0";
         this.hdProjectB2.Text       = "0";
         this.hdProjectB3.Text       = "0";
         this.InitDropDownList();
         this.ExpenseId = Request.Params["ExpenseId"];
         if (!string.IsNullOrEmpty(this.ExpenseId))
         {
             Model.CostGoods_Expense expense = BLL.ExpenseService.GetExpenseById(this.ExpenseId);
             if (expense != null)
             {
                 this.ProjectId = expense.ProjectId;
                 if (this.ProjectId != this.CurrUser.LoginProjectId)
                 {
                     this.InitDropDownList();
                 }
                 if (expense.Months != null)
                 {
                     //this.txtMonths.Text = string.Format("{0:yyyy-MM}", expense.Months);
                     this.drpYear.SelectedValue   = Convert.ToString(expense.Months.Value.Year);
                     this.drpMonths.SelectedValue = Convert.ToString(expense.Months.Value.Month);
                 }
                 this.txtExpenseCode.Text = CodeRecordsService.ReturnCodeByDataId(this.ExpenseId);
                 if (!string.IsNullOrEmpty(expense.UnitId))
                 {
                     this.drpUnitId.SelectedValue = expense.UnitId;
                 }
                 if (expense.ReportDate != null)
                 {
                     this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", expense.ReportDate);
                 }
                 //this.txtCompileMan.Text = expense.CompileMan;
                 //if (expense.CompileDate != null)
                 //{
                 //    this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", expense.CompileDate);
                 //}
                 //this.txtCheckMan.Text = expense.CheckMan;
                 //if (expense.CheckDate != null)
                 //{
                 //    this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", expense.CheckDate);
                 //}
                 //this.txtApproveMan.Text = expense.ApproveMan;
                 //if (expense.ApproveDate != null)
                 //{
                 //    this.txtApproveDate.Text = string.Format("{0:yyyy-MM-dd}", expense.ApproveDate);
                 //}
                 decimal            totalA = 0, totalB = 0, totalProjectA = 0, totalProjectB = 0;
                 Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(this.ProjectId);
                 List <Model.CostGoods_ExpenseDetail> projectDetails = BLL.ExpenseDetailService.GetCostDetailsByUnitId(expense.UnitId, project != null ? Convert.ToDateTime(project.StartDate) : Convert.ToDateTime("2000-01-01"), Convert.ToDateTime(expense.Months));
                 List <Model.CostGoods_ExpenseDetail> details        = BLL.ExpenseDetailService.GetExpenseDetailsByExpenseId(this.ExpenseId);
                 Model.CostGoods_ExpenseDetail        a1             = details.FirstOrDefault(x => x.CostType == "A1");
                 this.hdProjectA1.Text = (from x in projectDetails where x.CostType == "A1" select x.CostMoney ?? 0).Sum().ToString();
                 this.hdProjectA2.Text = (from x in projectDetails where x.CostType == "A2" select x.CostMoney ?? 0).Sum().ToString();
                 this.hdProjectA3.Text = (from x in projectDetails where x.CostType == "A3" select x.CostMoney ?? 0).Sum().ToString();
                 this.hdProjectA4.Text = (from x in projectDetails where x.CostType == "A4" select x.CostMoney ?? 0).Sum().ToString();
                 this.hdProjectA5.Text = (from x in projectDetails where x.CostType == "A5" select x.CostMoney ?? 0).Sum().ToString();
                 this.hdProjectA6.Text = (from x in projectDetails where x.CostType == "A6" select x.CostMoney ?? 0).Sum().ToString();
                 this.hdProjectB1.Text = (from x in projectDetails where x.CostType == "B1" select x.CostMoney ?? 0).Sum().ToString();
                 this.hdProjectB2.Text = (from x in projectDetails where x.CostType == "B2" select x.CostMoney ?? 0).Sum().ToString();
                 this.hdProjectB3.Text = (from x in projectDetails where x.CostType == "B3" select x.CostMoney ?? 0).Sum().ToString();
                 if (a1 != null)
                 {
                     this.nbA1.Text        = (a1.CostMoney ?? 0).ToString();
                     totalA               += Funs.GetNewDecimalOrZero(this.nbA1.Text);
                     this.nbProjectA1.Text = ((from x in projectDetails where x.CostType == "A1" select x.CostMoney ?? 0).Sum() + a1.CostMoney ?? 0).ToString();
                     totalProjectA        += Funs.GetNewDecimalOrZero(this.nbProjectA1.Text);
                     this.txtDefA1.Text    = a1.CostDef;
                 }
                 Model.CostGoods_ExpenseDetail a2 = details.FirstOrDefault(x => x.CostType == "A2");
                 if (a2 != null)
                 {
                     this.nbA2.Text        = (a2.CostMoney ?? 0).ToString();
                     totalA               += Funs.GetNewDecimalOrZero(this.nbA2.Text);
                     this.nbProjectA2.Text = ((from x in projectDetails where x.CostType == "A2" select x.CostMoney ?? 0).Sum() + a2.CostMoney ?? 0).ToString();
                     totalProjectA        += Funs.GetNewDecimalOrZero(this.nbProjectA2.Text);
                     this.txtDefA2.Text    = a2.CostDef;
                 }
                 Model.CostGoods_ExpenseDetail a3 = details.FirstOrDefault(x => x.CostType == "A3");
                 if (a3 != null)
                 {
                     this.nbA3.Text        = (a3.CostMoney ?? 0).ToString();
                     totalA               += Funs.GetNewDecimalOrZero(this.nbA3.Text);
                     this.nbProjectA3.Text = ((from x in projectDetails where x.CostType == "A3" select x.CostMoney ?? 0).Sum() + a3.CostMoney ?? 0).ToString();
                     totalProjectA        += Funs.GetNewDecimalOrZero(this.nbProjectA3.Text);
                     this.txtDefA3.Text    = a3.CostDef;
                 }
                 Model.CostGoods_ExpenseDetail a4 = details.FirstOrDefault(x => x.CostType == "A4");
                 if (a4 != null)
                 {
                     this.nbA4.Text        = (a4.CostMoney ?? 0).ToString();
                     totalA               += Funs.GetNewDecimalOrZero(this.nbA4.Text);
                     this.nbProjectA4.Text = ((from x in projectDetails where x.CostType == "A4" select x.CostMoney ?? 0).Sum() + a4.CostMoney ?? 0).ToString();
                     totalProjectA        += Funs.GetNewDecimalOrZero(this.nbProjectA4.Text);
                     this.txtDefA4.Text    = a4.CostDef;
                 }
                 Model.CostGoods_ExpenseDetail a5 = details.FirstOrDefault(x => x.CostType == "A5");
                 if (a5 != null)
                 {
                     this.nbA5.Text        = (a5.CostMoney ?? 0).ToString();
                     totalA               += Funs.GetNewDecimalOrZero(this.nbA5.Text);
                     this.nbProjectA5.Text = ((from x in projectDetails where x.CostType == "A5" select x.CostMoney ?? 0).Sum() + a5.CostMoney ?? 0).ToString();
                     totalProjectA        += Funs.GetNewDecimalOrZero(this.nbProjectA5.Text);
                     this.txtDefA5.Text    = a5.CostDef;
                 }
                 Model.CostGoods_ExpenseDetail a6 = details.FirstOrDefault(x => x.CostType == "A6");
                 if (a6 != null)
                 {
                     this.nbA6.Text        = (a6.CostMoney ?? 0).ToString();
                     totalA               += Funs.GetNewDecimalOrZero(this.nbA6.Text);
                     this.nbProjectA6.Text = ((from x in projectDetails where x.CostType == "A6" select x.CostMoney ?? 0).Sum() + a6.CostMoney ?? 0).ToString();
                     totalProjectA        += Funs.GetNewDecimalOrZero(this.nbProjectA6.Text);
                     this.txtDefA6.Text    = a6.CostDef;
                 }
                 this.nbA.Text        = totalA.ToString();
                 this.nbProjectA.Text = totalProjectA.ToString();
                 Model.CostGoods_ExpenseDetail b1 = details.FirstOrDefault(x => x.CostType == "B1");
                 if (b1 != null)
                 {
                     this.nbB1.Text        = (b1.CostMoney ?? 0).ToString();
                     totalB               += Funs.GetNewDecimalOrZero(this.nbB1.Text);
                     this.nbProjectB1.Text = ((from x in projectDetails where x.CostType == "B1" select x.CostMoney ?? 0).Sum() + b1.CostMoney ?? 0).ToString();
                     totalProjectB        += Funs.GetNewDecimalOrZero(this.nbProjectB1.Text);
                     this.txtDefB1.Text    = b1.CostDef;
                 }
                 Model.CostGoods_ExpenseDetail b2 = details.FirstOrDefault(x => x.CostType == "B2");
                 if (b2 != null)
                 {
                     this.nbB2.Text        = (b2.CostMoney ?? 0).ToString();
                     totalB               += Funs.GetNewDecimalOrZero(this.nbB2.Text);
                     this.nbProjectB2.Text = ((from x in projectDetails where x.CostType == "B2" select x.CostMoney ?? 0).Sum() + b2.CostMoney ?? 0).ToString();
                     totalProjectB        += Funs.GetNewDecimalOrZero(this.nbProjectB2.Text);
                     this.txtDefB2.Text    = b2.CostDef;
                 }
                 Model.CostGoods_ExpenseDetail b3 = details.FirstOrDefault(x => x.CostType == "B3");
                 if (b3 != null)
                 {
                     this.nbB3.Text        = (b3.CostMoney ?? 0).ToString();
                     totalB               += Funs.GetNewDecimalOrZero(this.nbB3.Text);
                     this.nbProjectB3.Text = ((from x in projectDetails where x.CostType == "B3" select x.CostMoney ?? 0).Sum() + b3.CostMoney ?? 0).ToString();
                     totalProjectB        += Funs.GetNewDecimalOrZero(this.nbProjectB3.Text);
                     this.txtDefB3.Text    = b3.CostDef;
                 }
                 this.nbB.Text         = totalB.ToString();
                 this.nbProjectB.Text  = totalProjectB.ToString();
                 this.nbAB.Text        = (totalA + totalB).ToString();
                 this.nbProjectAB.Text = (totalProjectA + totalProjectB).ToString();
             }
         }
         else
         {
             this.drpYear.SelectedValue   = Convert.ToString(DateTime.Now.Year);
             this.drpMonths.SelectedValue = Convert.ToString(DateTime.Now.Month);
             //this.txtMonths.Text = DateTime.Now.ToString("yyyy-MM");
             //this.txtCompileMan.Text = this.CurrUser.UserName;
             this.txtReportDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
             //this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
             ////自动生成编码
             this.txtExpenseCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectExpenseMenuId, this.ProjectId, this.CurrUser.UnitId);
         }
         ///初始化审核菜单
         this.ctlAuditFlow.MenuId    = BLL.Const.ProjectExpenseMenuId;
         this.ctlAuditFlow.DataId    = this.ExpenseId;
         this.ctlAuditFlow.ProjectId = this.ProjectId;
         this.ctlAuditFlow.UnitId    = this.CurrUser.UnitId;
     }
 }
예제 #10
0
        public static void AutoCode(List <string> classes)
        {
            // 自动生成所有需要委托
            Dictionary <string, Funs> allfuns = new Dictionary <string, Funs>(); // 所有的需要导出的函数原形列表

            var flag = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.DeclaredOnly;

            HashSet <int>    ObjectsParamCount = new HashSet <int>();
            HashSet <string> exports           = new HashSet <string>(classes);

            foreach (var ator in System.AppDomain.CurrentDomain.GetAssemblies())
            {
                if (ator.FullName.StartsWith("System"))
                {
                    continue;
                }

                foreach (var type in ator.GetTypes())
                {
                    if (exports.Contains(type.FullName.Replace('+', '/')) || type.GetCustomAttributes(typeof(HotfixAttribute), false).Length != 0)
                    {
                        if (type.IsGenericType)
                        {
                            continue;
                        }

                        foreach (var method in type.GetMethods(flag))
                        {
                            if (method.IsGenericMethod)
                            {
                                continue;
                            }

                            if (IsEditorAttribute(method))
                            {
                                continue;
                            }

                            Funs fun = new Funs(method, method.IsStatic ? false : true);
                            if (!fun.isExport)
                            {
                                continue;
                            }

                            string key = fun.oid;
                            Funs   rs;
                            if (allfuns.TryGetValue(key, out rs))
                            {
                                rs.methods.Add(method);
                                continue;
                            }

                            allfuns.Add(key, fun);
                        }

                        // MonoBehaviour类型不重载构造函数
                        if (IsUnityObjectType(type))
                        {
                            continue;
                        }

                        foreach (var ctor in type.GetConstructors(flag))
                        {
                            if (ctor.IsGenericMethod)
                            {
                                continue;
                            }

                            if (IsEditorAttribute(ctor))
                            {
                                continue;
                            }

                            Funs fun = new Funs(ctor, ctor.IsStatic ? false : true);
                            if (!fun.isExport)
                            {
                                continue;
                            }

                            string key = fun.oid;
                            Funs   rs;
                            if (allfuns.TryGetValue(key, out rs))
                            {
                                rs.methods.Add(ctor);
                                continue;
                            }

                            allfuns.Add(key, fun);
                        }
                    }
                }
            }

            string file = string.Format("Assets/ZJY_Framework/ILRuntime/Generated/GenDelegateBridge.cs");

            System.IO.Directory.CreateDirectory(file.Substring(0, file.LastIndexOf('/')));

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            string name  = "__Gen_Delegate_Imp";
            int    index = 0;

            foreach (var ator in allfuns)
            {
                ator.Value.toInfo("        ", sb);
                int paramCount = 0;
                sb.AppendFormat("        {0}", ator.Value.toString(name + (++index), out paramCount));
                sb.AppendLine();
                if (paramCount != 0)
                {
                    ObjectsParamCount.Add(paramCount);
                }
            }

            System.IO.File.WriteAllText(file, string.Format(file_format, sb.ToString()));
            UnityEngine.Debug.LogFormat("count:{0}", allfuns.Count);

            sb.Length = 0;
            sb.AppendLine(string.Format("countType:{0}", classes.Count));
            foreach (var ator in classes)
            {
                sb.AppendLine(ator);
            }

            GeneratorObjects.Gen(ObjectsParamCount);
        }
예제 #11
0
        /// <summary>
        ///
        /// </summary>
        private void SaveNew(bool isWuHuan)
        {
            if (string.IsNullOrEmpty(this.CheckWorkId))
            {
                Model.Check_CheckWork checkWork = new Model.Check_CheckWork
                {
                    CheckWorkId   = SQLHelper.GetNewID(typeof(Model.Check_CheckWork)),
                    CheckWorkCode = this.txtCheckWorkCode.Text.Trim(),
                    CheckTime     = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim()),
                    ProjectId     = this.ProjectId,
                    Area          = this.txtArea.Text.Trim()
                };
                if (!string.IsNullOrEmpty(this.drpThisUnit.SelectedValue))
                {
                    checkWork.ThisUnitId = this.drpThisUnit.SelectedValue;
                }
                //本单位人员
                string mainUnitPerson = string.Empty;
                foreach (var item in this.drpMainUnitPerson.SelectedValueArray)
                {
                    mainUnitPerson += item + ",";
                }
                if (!string.IsNullOrEmpty(mainUnitPerson))
                {
                    mainUnitPerson = mainUnitPerson.Substring(0, mainUnitPerson.LastIndexOf(","));
                }
                checkWork.MainUnitPerson = mainUnitPerson;
                //参与单位
                string subUnits = string.Empty;
                foreach (var item in this.drpSubUnits.SelectedValueArray)
                {
                    subUnits += item + ",";
                }
                if (!string.IsNullOrEmpty(subUnits))
                {
                    checkWork.SubUnits = subUnits.Substring(0, subUnits.LastIndexOf(","));
                }
                //参与用户
                string subUnitPerson = string.Empty;
                foreach (var item in this.drpSubUnitPerson.SelectedValueArray)
                {
                    if (item != BLL.Const._Null)
                    {
                        subUnitPerson += item + ",";
                    }
                }
                if (!string.IsNullOrEmpty(subUnitPerson))
                {
                    checkWork.SubUnitPerson = subUnitPerson.Substring(0, subUnitPerson.LastIndexOf(","));
                }

                //if (this.ckbIsCompleted.Checked)
                //{
                //    checkWork.IsCompleted = true;
                //}

                checkWork.PartInPersonNames  = this.txtPartInPersonNames.Text.Trim();
                checkWork.MainUnitDeputy     = this.txtMainUnitDeputy.Text.Trim();
                checkWork.MainUnitDeputyDate = Funs.GetNewDateTime(this.txtMainUnitDeputyDate.Text.Trim());
                checkWork.SubUnitDeputy      = this.txtSubUnitDeputy.Text.Trim();
                checkWork.SubUnitDeputyDate  = Funs.GetNewDateTime(this.txtSubUnitDeputyDate.Text.Trim());
                checkWork.CompileMan         = this.CurrUser.UserId;
                ////单据状态
                checkWork.States = BLL.Const.State_0;
                this.CheckWorkId = checkWork.CheckWorkId;
                if (this.ckIsAgree.Checked)
                {
                    checkWork.IsAgree = true;
                }
                BLL.Check_CheckWorkService.AddCheckWork(checkWork);
                BLL.LogService.AddSys_Log(this.CurrUser, checkWork.CheckWorkCode, checkWork.CheckWorkId, BLL.Const.ProjectCheckWorkMenuId, BLL.Const.BtnAdd);
                if (isWuHuan)
                {
                    checkWorkDetails = (from x in Funs.DB.Check_ProjectCheckItemDetail
                                        join y in Funs.DB.Check_ProjectCheckItemSet on x.CheckItemSetId equals y.CheckItemSetId
                                        where y.ProjectId == this.ProjectId && y.CheckType == "4"
                                        orderby y.SortIndex
                                        select new Model.View_Check_CheckWorkDetail
                    {
                        CheckWorkId = this.CheckWorkId,
                        CheckItem = y.CheckItemSetId,
                        CheckContent = x.CheckContent,
                        CheckItemStr = x.CheckContent,
                        SortIndex = x.SortIndex,
                        CheckResult = "合格",
                    }).ToList();
                    foreach (var item in checkWorkDetails)
                    {
                        Model.Check_CheckWorkDetail detail = new Model.Check_CheckWorkDetail
                        {
                            CheckWorkDetailId = SQLHelper.GetNewID(typeof(Model.Check_CheckWorkDetail)),
                            CheckWorkId       = item.CheckWorkId,
                            CheckItem         = item.CheckItem,
                            CheckContent      = item.CheckContent,
                            SortIndex         = item.SortIndex,
                            CheckResult       = item.CheckResult,
                        };

                        BLL.Check_CheckWorkDetailService.AddCheckWorkDetail(detail);
                    }
                }
            }
        }
예제 #12
0
 /// <summary>
 /// 单价、工程量联动事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void txtQuantity_TextChanged(object sender, EventArgs e)
 {
     this.txtRatifiedTotalPrice.Text = (Funs.GetNewDecimalOrZero(this.txtRatifiedQuantity.Text) * Funs.GetNewDecimalOrZero(this.txtRatifiedPrice.Text)).ToString("#0.0000");
 }
예제 #13
0
 /// <summary>
 /// 保存数据
 /// </summary>
 /// <param name="p"></param>
 private void SaveData(string type)
 {
     Model.Check_ViolationPerson violationPerson = new Model.Check_ViolationPerson
     {
         ProjectId           = this.ProjectId,
         ViolationPersonCode = this.txtViolationPersonCode.Text.Trim()
     };
     if (!string.IsNullOrEmpty(this.drpPersonId.Value))
     {
         violationPerson.PersonId = this.drpPersonId.Value;
     }
     if (!string.IsNullOrEmpty(this.hdUnitId.Text.Trim()))
     {
         violationPerson.UnitId = this.hdUnitId.Text.Trim();
     }
     if (!string.IsNullOrEmpty(this.hdWorkPostId.Text.Trim()))
     {
         violationPerson.WorkPostId = this.hdWorkPostId.Text.Trim();
     }
     violationPerson.ViolationDate = Funs.GetNewDateTime(this.txtViolationDate.Text.Trim());
     if (this.drpViolationName.SelectedValue != BLL.Const._Null)
     {
         if (!string.IsNullOrEmpty(this.drpViolationName.SelectedValue))
         {
             violationPerson.ViolationName = this.drpViolationName.SelectedValue.Trim();
         }
     }
     if (this.drpViolationType.SelectedValue != BLL.Const._Null)
     {
         if (!string.IsNullOrEmpty(this.drpViolationType.SelectedValue))
         {
             violationPerson.ViolationType = this.drpViolationType.SelectedValue.Trim();
         }
     }
     if (this.drpHandleStep.SelectedValue != BLL.Const._Null)
     {
         if (!string.IsNullOrEmpty(this.drpHandleStep.SelectedValue))
         {
             violationPerson.HandleStep = this.drpHandleStep.SelectedValue.Trim();
         }
     }
     violationPerson.ViolationDef = this.txtViolationDef.Text.Trim();
     violationPerson.CompileMan   = this.CurrUser.UserId;
     violationPerson.CompileDate  = DateTime.Now;
     violationPerson.States       = BLL.Const.State_0;
     if (type == BLL.Const.BtnSubmit)
     {
         violationPerson.States = this.ctlAuditFlow.NextStep;
     }
     if (!string.IsNullOrEmpty(this.ViolationPersonId))
     {
         violationPerson.ViolationPersonId = this.ViolationPersonId;
         BLL.ViolationPersonService.UpdateViolationPerson(violationPerson);
         BLL.LogService.AddSys_Log(this.CurrUser, violationPerson.ViolationPersonCode, violationPerson.ViolationPersonId, BLL.Const.ProjectViolationPersonMenuId, BLL.Const.BtnModify);
     }
     else
     {
         this.ViolationPersonId            = SQLHelper.GetNewID(typeof(Model.Check_ViolationPerson));
         violationPerson.ViolationPersonId = this.ViolationPersonId;
         BLL.ViolationPersonService.AddViolationPerson(violationPerson);
         BLL.LogService.AddSys_Log(this.CurrUser, violationPerson.ViolationPersonCode, violationPerson.ViolationPersonId, BLL.Const.ProjectViolationPersonMenuId, BLL.Const.BtnAdd);
     }
     ////保存流程审核数据
     this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectViolationPersonMenuId, this.ViolationPersonId, (type == BLL.Const.BtnSubmit ? true : false), violationPerson.ViolationPersonCode, "../Check/ViolationPersonView.aspx?ViolationPersonId={0}");
 }
예제 #14
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            Model.Check_CheckColligation checkColligation = new Model.Check_CheckColligation
            {
                CheckColligationCode = this.txtCheckColligationCode.Text.Trim(),
                ProjectId            = this.ProjectId
            };
            if (this.drpCheckType.SelectedValue != BLL.Const._Null)
            {
                checkColligation.CheckType = this.drpCheckType.SelectedValue;
            }
            //参与单位
            string unitIds = string.Empty;

            foreach (var item in this.drpUnit.SelectedValueArray)
            {
                unitIds += item + ",";
            }
            if (!string.IsNullOrEmpty(unitIds))
            {
                unitIds = unitIds.Substring(0, unitIds.LastIndexOf(","));
            }
            checkColligation.PartInUnits = unitIds;
            if (this.drpCheckPerson.SelectedValue != BLL.Const._Null)
            {
                checkColligation.CheckPerson = this.drpCheckPerson.SelectedValue;
            }
            ///组成员
            string partInPersonIds = string.Empty;
            string partInPersons   = string.Empty;

            foreach (var item in this.drpPartInPersons.SelectedValueArray)
            {
                var user = BLL.UserService.GetUserByUserId(item);
                if (user != null)
                {
                    partInPersonIds += user.UserId + ",";
                    partInPersons   += user.UserName + ",";
                }
            }
            if (!string.IsNullOrEmpty(partInPersonIds))
            {
                checkColligation.PartInPersonIds = partInPersonIds.Substring(0, partInPersonIds.LastIndexOf(","));
                checkColligation.PartInPersons   = partInPersons.Substring(0, partInPersons.LastIndexOf(","));
            }

            checkColligation.PartInPersonNames = this.txtPartInPersonNames.Text.Trim();

            //检查区域
            //string workAreaIds = string.Empty;
            //foreach (var item in this.drpCheckAreas.SelectedValueArray)
            //{
            //    workAreaIds += item + ",";
            //}
            //if (!string.IsNullOrEmpty(workAreaIds))
            //{
            //    workAreaIds = workAreaIds.Substring(0, workAreaIds.LastIndexOf(","));
            //}
            //checkColligation.CheckAreas = workAreaIds;
            checkColligation.CheckTime  = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim());
            checkColligation.DaySummary = HttpUtility.HtmlEncode(this.txtDaySummary.Text.Trim());
            ////单据状态
            checkColligation.States = BLL.Const.State_0;
            if (type == BLL.Const.BtnSubmit)
            {
                checkColligation.States = this.ctlAuditFlow.NextStep;
            }
            if (!string.IsNullOrEmpty(this.CheckColligationId))
            {
                checkColligation.CheckColligationId = this.CheckColligationId;
                BLL.Check_CheckColligationService.UpdateCheckColligation(checkColligation);
                BLL.LogService.AddSys_Log(this.CurrUser, checkColligation.CheckColligationCode, checkColligation.CheckColligationId, BLL.Const.ProjectCheckColligationMenuId, BLL.Const.BtnModify);
            }
            else
            {
                checkColligation.CheckColligationId = SQLHelper.GetNewID(typeof(Model.Check_CheckColligation));
                this.CheckColligationId             = checkColligation.CheckColligationId;
                checkColligation.CompileMan         = this.CurrUser.UserId;
                BLL.Check_CheckColligationService.AddCheckColligation(checkColligation);
                BLL.LogService.AddSys_Log(this.CurrUser, checkColligation.CheckColligationCode, checkColligation.CheckColligationId, BLL.Const.ProjectCheckColligationMenuId, BLL.Const.BtnAdd);
            }
            ////保存流程审核数据
            this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectCheckColligationMenuId, this.CheckColligationId, (type == BLL.Const.BtnSubmit ? true : false), this.txtCheckDate.Text.Trim(), "../Check/CheckColligationView.aspx?CheckColligationId={0}");
        }
예제 #15
0
        /// <summary>
        /// 将Dataset的数据导入数据库
        /// </summary>
        /// <param name="pds">数据集</param>
        /// <param name="Cols">数据集行数</param>
        /// <returns></returns>
        private bool AddDatasetToSQL(DataTable pds, int Cols)
        {
            string result = string.Empty;
            int    ic, ir;

            ic = pds.Columns.Count;
            if (ic < Cols)
            {
                ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "行", MessageBoxIcon.Warning);
            }

            ir = pds.Rows.Count;
            if (pds != null && ir > 0)
            {
                var accidentTypes = from x in Funs.DB.Sys_Const where x.GroupId == "0012" select x;
                for (int i = 0; i < ir; i++)
                {
                    string row1   = pds.Rows[i][0].ToString();
                    string unitId = string.Empty;
                    if (!string.IsNullOrEmpty(row1))
                    {
                        var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == row1.Trim());
                        if (unit == null)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "填报单位" + "," + "[" + row1 + "]不存在!" + "|";
                        }
                        else
                        {
                            unitId = unit.UnitId;
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "填报单位" + "," + "此项为必填项!" + "|";
                    }
                    string row2 = pds.Rows[i][1].ToString();
                    if (string.IsNullOrEmpty(row2))
                    {
                        result += "第" + (i + 2).ToString() + "行," + "编号" + "," + "此项为必填项!" + "|";
                    }
                    string row3 = pds.Rows[i][2].ToString();
                    if (!string.IsNullOrEmpty(row3))
                    {
                        try
                        {
                            Int32 year = Convert.ToInt32(row3.Trim());
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "年份" + "," + "[" + row3 + "]错误!" + "|";
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "年份" + "," + "此项为必填项!" + "|";
                    }
                    string row4 = pds.Rows[i][3].ToString();
                    if (!string.IsNullOrEmpty(row4))
                    {
                        try
                        {
                            Int32 month = Convert.ToInt32(row4.Trim());
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "月份" + "," + "[" + row4 + "]错误!" + "|";
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "月份" + "," + "此项为必填项!" + "|";
                    }

                    ////判断是否 已存在该月份数据
                    var accidentCauseReport = BLL.AccidentCauseReportService.GetAccidentCauseReportByUnitIdAndYearAndMonth(unitId, Funs.GetNewIntOrZero(row3.Trim()), Funs.GetNewIntOrZero(row4.Trim()));
                    if (accidentCauseReport != null)
                    {
                        result += "第" + (i + 2).ToString() + "行," + "已存在该月份月报!" + "|";
                    }

                    string row5 = pds.Rows[i][4].ToString().Trim();
                    if (!string.IsNullOrEmpty(row5))
                    {
                        try
                        {
                            Int32 deathAccident = Convert.ToInt32(row5);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "死亡事故数" + "," + "[" + row5 + "]错误!" + "|";
                        }
                    }
                    string row6 = pds.Rows[i][5].ToString().Trim();
                    if (!string.IsNullOrEmpty(row6))
                    {
                        try
                        {
                            Int32 deathToll = Convert.ToInt32(row6);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "死亡人数" + "," + "[" + row6 + "]错误!" + "|";
                        }
                    }
                    string row7 = pds.Rows[i][6].ToString().Trim();
                    if (!string.IsNullOrEmpty(row7))
                    {
                        try
                        {
                            Int32 injuredAccident = Convert.ToInt32(row7);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "重伤事故" + "," + "[" + row7 + "]错误!" + "|";
                        }
                    }
                    string row8 = pds.Rows[i][7].ToString().Trim();
                    if (!string.IsNullOrEmpty(row8))
                    {
                        try
                        {
                            Int32 injuredToll = Convert.ToInt32(row8);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "重伤人数" + "," + "[" + row8 + "]错误!" + "|";
                        }
                    }
                    string row9 = pds.Rows[i][8].ToString().Trim();
                    if (!string.IsNullOrEmpty(row9))
                    {
                        try
                        {
                            Int32 minorWoundAccident = Convert.ToInt32(row9);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "轻伤事故" + "," + "[" + row9 + "]错误!" + "|";
                        }
                    }
                    string row10 = pds.Rows[i][9].ToString().Trim();
                    if (!string.IsNullOrEmpty(row10))
                    {
                        try
                        {
                            Int32 minorWoundToll = Convert.ToInt32(row10);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "轻伤人数" + "," + "[" + row10 + "]错误!" + "|";
                        }
                    }
                    string row11 = pds.Rows[i][10].ToString().Trim();
                    if (!string.IsNullOrEmpty(row11))
                    {
                        try
                        {
                            Decimal averageTotalHours = Funs.GetNewDecimalOrZero(row11);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "平均工时总数" + "," + "[" + row11 + "]错误!" + "|";
                        }
                    }
                    string row12 = pds.Rows[i][11].ToString().Trim();
                    if (!string.IsNullOrEmpty(row12))
                    {
                        try
                        {
                            Int32 averageManHours = Convert.ToInt32(row12);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "平均工时人数" + "," + "[" + row12 + "]错误!" + "|";
                        }
                    }
                    string row13 = pds.Rows[i][12].ToString().Trim();
                    if (!string.IsNullOrEmpty(row13))
                    {
                        try
                        {
                            Int32 totalLossMan = Convert.ToInt32(row13);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "损失工时总数" + "," + "[" + row13 + "]错误!" + "|";
                        }
                    }
                    string row14 = pds.Rows[i][13].ToString().Trim();
                    if (!string.IsNullOrEmpty(row14))
                    {
                        try
                        {
                            Int32 lastMonthLossHoursTotal = Convert.ToInt32(row14);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "上月损失工时总数" + "," + "[" + row14 + "]错误!" + "|";
                        }
                    }
                    string row15 = pds.Rows[i][14].ToString().Trim();
                    if (!string.IsNullOrEmpty(row15))
                    {
                        try
                        {
                            Int32 knockOffTotal = Convert.ToInt32(row15);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "歇工总日数" + "," + "[" + row15 + "]错误!" + "|";
                        }
                    }
                    string row16 = pds.Rows[i][15].ToString().Trim();
                    if (!string.IsNullOrEmpty(row16))
                    {
                        try
                        {
                            Int32 directLoss = Convert.ToInt32(row16);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "直接损失" + "," + "[" + row16 + "]错误!" + "|";
                        }
                    }
                    string row17 = pds.Rows[i][16].ToString().Trim();
                    if (!string.IsNullOrEmpty(row17))
                    {
                        try
                        {
                            Int32 indirectLosses = Convert.ToInt32(row17);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "间接损失" + "," + "[" + row17 + "]错误!" + "|";
                        }
                    }
                    string row18 = pds.Rows[i][17].ToString().Trim();
                    if (!string.IsNullOrEmpty(row18))
                    {
                        try
                        {
                            Int32 totalLoss = Convert.ToInt32(row18);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "总损失" + "," + "[" + row18 + "]错误!" + "|";
                        }
                    }
                    string row19 = pds.Rows[i][18].ToString().Trim();
                    if (!string.IsNullOrEmpty(row19))
                    {
                        try
                        {
                            Int32 totalLossTime = Convert.ToInt32(row19);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "无损失工时总数" + "," + "[" + row19 + "]错误!" + "|";
                        }
                    }
                    //string row20 = pds.Rows[i][19].ToString().Trim();
                    string row21 = pds.Rows[i][20].ToString().Trim();
                    if (!string.IsNullOrEmpty(row21))
                    {
                        if (accidentTypes.Where(x => x.ConstValue == row21.Trim()).FirstOrDefault() == null)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "事故类别" + "," + "[" + row21 + "]不存在!" + "|";
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "事故类别" + "," + "此项为必填项!" + "|";
                    }
                    string row22 = pds.Rows[i][21].ToString().Trim();
                    if (!string.IsNullOrEmpty(row22))
                    {
                        try
                        {
                            Int32 death1 = Convert.ToInt32(row22);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "防护保险信号缺失死亡数" + "," + "[" + row22 + "]错误!" + "|";
                        }
                    }
                    string row23 = pds.Rows[i][22].ToString().Trim();
                    if (!string.IsNullOrEmpty(row23))
                    {
                        try
                        {
                            Int32 injuries1 = Convert.ToInt32(row23);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "防护保险信号缺失重伤数" + "," + "[" + row23 + "]错误!" + "|";
                        }
                    }
                    string row24 = pds.Rows[i][23].ToString().Trim();
                    if (!string.IsNullOrEmpty(row24))
                    {
                        try
                        {
                            Int32 minorInjuries1 = Convert.ToInt32(row24);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "防护保险信号缺失轻伤数" + "," + "[" + row24 + "]错误!" + "|";
                        }
                    }
                    string row25 = pds.Rows[i][24].ToString().Trim();
                    if (!string.IsNullOrEmpty(row25))
                    {
                        try
                        {
                            Int32 death2 = Convert.ToInt32(row25);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "设备工具缺陷死亡数" + "," + "[" + row25 + "]错误!" + "|";
                        }
                    }
                    string row26 = pds.Rows[i][25].ToString().Trim();
                    if (!string.IsNullOrEmpty(row26))
                    {
                        try
                        {
                            Int32 injuries2 = Convert.ToInt32(row26);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "设备工具缺陷重伤数" + "," + "[" + row26 + "]错误!" + "|";
                        }
                    }
                    string row27 = pds.Rows[i][26].ToString().Trim();
                    if (!string.IsNullOrEmpty(row27))
                    {
                        try
                        {
                            Int32 minorInjuries2 = Convert.ToInt32(row27);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "设备工具缺陷轻伤数" + "," + "[" + row27 + "]错误!" + "|";
                        }
                    }
                    string row28 = pds.Rows[i][27].ToString().Trim();
                    if (!string.IsNullOrEmpty(row28))
                    {
                        try
                        {
                            Int32 death3 = Convert.ToInt32(row28);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "个人防护缺陷死亡数" + "," + "[" + row28 + "]错误!" + "|";
                        }
                    }
                    string row29 = pds.Rows[i][28].ToString().Trim();
                    if (!string.IsNullOrEmpty(row29))
                    {
                        try
                        {
                            Int32 injuries3 = Convert.ToInt32(row29);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "个人防护缺陷重伤数" + "," + "[" + row29 + "]错误!" + "|";
                        }
                    }
                    string row30 = pds.Rows[i][29].ToString().Trim();
                    if (!string.IsNullOrEmpty(row30))
                    {
                        try
                        {
                            Int32 minorInjuries3 = Convert.ToInt32(row30);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "个人防护缺陷轻伤数" + "," + "[" + row30 + "]错误!" + "|";
                        }
                    }
                    string row31 = pds.Rows[i][30].ToString().Trim();
                    if (!string.IsNullOrEmpty(row31))
                    {
                        try
                        {
                            Int32 death4 = Convert.ToInt32(row31);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "光线不足死亡数" + "," + "[" + row31 + "]错误!" + "|";
                        }
                    }
                    string row32 = pds.Rows[i][31].ToString().Trim();
                    if (!string.IsNullOrEmpty(row32))
                    {
                        try
                        {
                            Int32 injuries4 = Convert.ToInt32(row32);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "光线不足重伤数" + "," + "[" + row32 + "]错误!" + "|";
                        }
                    }
                    string row33 = pds.Rows[i][32].ToString().Trim();
                    if (!string.IsNullOrEmpty(row33))
                    {
                        try
                        {
                            Int32 minorInjuries4 = Convert.ToInt32(row33);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "光线不足轻伤数" + "," + "[" + row33 + "]错误!" + "|";
                        }
                    }
                    string row34 = pds.Rows[i][33].ToString().Trim();
                    if (!string.IsNullOrEmpty(row34))
                    {
                        try
                        {
                            Int32 death5 = Convert.ToInt32(row34);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "劳动组织不合理死亡数" + "," + "[" + row34 + "]错误!" + "|";
                        }
                    }
                    string row35 = pds.Rows[i][34].ToString().Trim();
                    if (!string.IsNullOrEmpty(row35))
                    {
                        try
                        {
                            Int32 injuries5 = Convert.ToInt32(row35);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "劳动组织不合理重伤数" + "," + "[" + row35 + "]错误!" + "|";
                        }
                    }
                    string row36 = pds.Rows[i][35].ToString().Trim();
                    if (!string.IsNullOrEmpty(row36))
                    {
                        try
                        {
                            Int32 minorInjuries5 = Convert.ToInt32(row36);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "劳动组织不合理轻伤数" + "," + "[" + row36 + "]错误!" + "|";
                        }
                    }
                    string row37 = pds.Rows[i][36].ToString().Trim();
                    if (!string.IsNullOrEmpty(row37))
                    {
                        try
                        {
                            Int32 death6 = Convert.ToInt32(row37);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "现场指导错误死亡数" + "," + "[" + row37 + "]错误!" + "|";
                        }
                    }
                    string row38 = pds.Rows[i][37].ToString().Trim();
                    if (!string.IsNullOrEmpty(row38))
                    {
                        try
                        {
                            Int32 injuries6 = Convert.ToInt32(row38);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "现场指导错误重伤数" + "," + "[" + row38 + "]错误!" + "|";
                        }
                    }
                    string row39 = pds.Rows[i][38].ToString().Trim();
                    if (!string.IsNullOrEmpty(row39))
                    {
                        try
                        {
                            Int32 minorInjuries6 = Convert.ToInt32(row39);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "现场指导错误轻伤数" + "," + "[" + row39 + "]错误!" + "|";
                        }
                    }
                    string row40 = pds.Rows[i][39].ToString().Trim();
                    if (!string.IsNullOrEmpty(row40))
                    {
                        try
                        {
                            Int32 death7 = Convert.ToInt32(row40);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "设计有缺陷死亡数" + "," + "[" + row40 + "]错误!" + "|";
                        }
                    }
                    string row41 = pds.Rows[i][40].ToString().Trim();
                    if (!string.IsNullOrEmpty(row41))
                    {
                        try
                        {
                            Int32 injuries7 = Convert.ToInt32(row41);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "设计有缺陷重伤数" + "," + "[" + row41 + "]错误!" + "|";
                        }
                    }
                    string row42 = pds.Rows[i][41].ToString().Trim();
                    if (!string.IsNullOrEmpty(row42))
                    {
                        try
                        {
                            Int32 minorInjuries7 = Convert.ToInt32(row42);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "设计有缺陷轻伤数" + "," + "[" + row42 + "]错误!" + "|";
                        }
                    }
                    string row43 = pds.Rows[i][42].ToString().Trim();
                    if (!string.IsNullOrEmpty(row43))
                    {
                        try
                        {
                            Int32 death8 = Convert.ToInt32(row43);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "不懂操作死亡数" + "," + "[" + row43 + "]错误!" + "|";
                        }
                    }
                    string row44 = pds.Rows[i][43].ToString().Trim();
                    if (!string.IsNullOrEmpty(row44))
                    {
                        try
                        {
                            Int32 injuries8 = Convert.ToInt32(row44);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "不懂操作重伤数" + "," + "[" + row44 + "]错误!" + "|";
                        }
                    }
                    string row45 = pds.Rows[i][44].ToString().Trim();
                    if (!string.IsNullOrEmpty(row45))
                    {
                        try
                        {
                            Int32 minorInjuries8 = Convert.ToInt32(row45);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "不懂操作轻伤数" + "," + "[" + row45 + "]错误!" + "|";
                        }
                    }
                    string row46 = pds.Rows[i][45].ToString().Trim();
                    if (!string.IsNullOrEmpty(row46))
                    {
                        try
                        {
                            Int32 death9 = Convert.ToInt32(row46);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "违反操作死亡数" + "," + "[" + row46 + "]错误!" + "|";
                        }
                    }
                    string row47 = pds.Rows[i][46].ToString().Trim();
                    if (!string.IsNullOrEmpty(row47))
                    {
                        try
                        {
                            Int32 injuries9 = Convert.ToInt32(row47);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "违反操作重伤数" + "," + "[" + row47 + "]错误!" + "|";
                        }
                    }
                    string row48 = pds.Rows[i][47].ToString().Trim();
                    if (!string.IsNullOrEmpty(row48))
                    {
                        try
                        {
                            Int32 minorInjuries9 = Convert.ToInt32(row48);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "违反操作轻伤数" + "," + "[" + row48 + "]错误!" + "|";
                        }
                    }
                    string row49 = pds.Rows[i][48].ToString().Trim();
                    if (!string.IsNullOrEmpty(row49))
                    {
                        try
                        {
                            Int32 death10 = Convert.ToInt32(row49);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "没有安全操作死亡数" + "," + "[" + row49 + "]错误!" + "|";
                        }
                    }
                    string row50 = pds.Rows[i][49].ToString().Trim();
                    if (!string.IsNullOrEmpty(row50))
                    {
                        try
                        {
                            Int32 injuries10 = Convert.ToInt32(row50);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "没有安全操作重伤数" + "," + "[" + row50 + "]错误!" + "|";
                        }
                    }
                    string row51 = pds.Rows[i][50].ToString().Trim();
                    if (!string.IsNullOrEmpty(row51))
                    {
                        try
                        {
                            Int32 minorInjuries10 = Convert.ToInt32(row51);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "没有安全操作轻伤数" + "," + "[" + row51 + "]错误!" + "|";
                        }
                    }
                    string row52 = pds.Rows[i][51].ToString().Trim();
                    if (!string.IsNullOrEmpty(row52))
                    {
                        try
                        {
                            Int32 death11 = Convert.ToInt32(row52);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "其他死亡数" + "," + "[" + row52 + "]错误!" + "|";
                        }
                    }
                    string row53 = pds.Rows[i][52].ToString().Trim();
                    if (!string.IsNullOrEmpty(row53))
                    {
                        try
                        {
                            Int32 injuries11 = Convert.ToInt32(row53);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "其他重伤数" + "," + "[" + row53 + "]错误!" + "|";
                        }
                    }
                    string row54 = pds.Rows[i][53].ToString().Trim();
                    if (!string.IsNullOrEmpty(row54))
                    {
                        try
                        {
                            Int32 minorInjuries11 = Convert.ToInt32(row54);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "其他轻伤数" + "," + "[" + row54 + "]错误!" + "|";
                        }
                    }
                }
                if (!string.IsNullOrEmpty(result))
                {
                    result = result.Substring(0, result.LastIndexOf("|"));
                    ShowNotify(result, MessageBoxIcon.Warning);
                    Session["errorInfos"] = result;
                }
                else
                {
                    Session["errorInfos"] = null;
                    ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
                }
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            }
            else
            {
                ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
            }
            return(true);
        }
예제 #16
0
        /// <summary>
        /// 加载页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
                this.ProjectId = this.CurrUser.LoginProjectId;
                this.drpCheckTypeCode.DataValueField = "CheckTypeCode";
                this.drpCheckTypeCode.DataTextField  = "CheckTypeContent";
                this.drpCheckTypeCode.DataSource     = BLL.CheckTypeSetService.GetCheckTypeSetList();
                this.drpCheckTypeCode.DataBind();
                Funs.FineUIPleaseSelect(this.drpCheckTypeCode);

                this.drpViolationRule.DataValueField = "ViolationRuleId";
                this.drpViolationRule.DataTextField  = "ViolationRule";
                this.drpViolationRule.DataSource     = ViolationRuleService.GetViolationRuleList();
                this.drpViolationRule.DataBind();
                Funs.FineUIPleaseSelect(this.drpViolationRule);

                this.ManageCheckId = Request.Params["ManageCheckId"];
                if (!string.IsNullOrEmpty(this.ManageCheckId))
                {
                    Model.Administrative_ManageCheck manageCheck = BLL.ManageCheckService.GetManageCheckById(this.ManageCheckId);
                    if (manageCheck != null)
                    {
                        this.ProjectId        = manageCheck.ProjectId;
                        this.Grid1.DataSource = BLL.CheckTypeSetService.GetCheckTypeSetsBySupCheckTypeCode(manageCheck.CheckTypeCode, ManageCheckId);
                        this.Grid1.PageIndex  = 0;
                        this.Grid1.DataBind();
                        if (Grid1.Rows.Count > 0)
                        {
                            this.Grid1.Hidden = false;
                        }

                        this.txtManageCheckCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.ManageCheckId);
                        if (manageCheck.CheckTypeCode != null)
                        {
                            this.drpCheckTypeCode.SelectedValue = manageCheck.CheckTypeCode;
                        }
                        this.txtSupplyCheck.Text            = manageCheck.SupplyCheck;
                        this.drpIsSupplyCheck.SelectedValue = Convert.ToString(manageCheck.IsSupplyCheck);
                        this.drpViolationRule.SelectedValue = Convert.ToString(manageCheck.ViolationRule);
                        this.txtCheckPerson.Text            = manageCheck.CheckPerson;
                        if (manageCheck.CheckTime != null)
                        {
                            this.txtCheckTime.Text = string.Format("{0:yyyy-MM-dd}", manageCheck.CheckTime);
                        }
                        this.txtVerifyPerson.Text = manageCheck.VerifyPerson;
                        if (manageCheck.VerifyTime != null)
                        {
                            this.txtVerifyTime.Text = string.Format("{0:yyyy-MM-dd}", manageCheck.VerifyTime);
                        }
                    }
                }
                else
                {
                    ////自动生成编码
                    this.txtManageCheckCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ManageCheckMenuId, this.ProjectId, this.CurrUser.UnitId);
                    this.txtCheckTime.Text       = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
                    this.txtVerifyTime.Text      = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
                }
                ///初始化审核菜单
                this.ctlAuditFlow.MenuId    = BLL.Const.ManageCheckMenuId;
                this.ctlAuditFlow.DataId    = this.ManageCheckId;
                this.ctlAuditFlow.ProjectId = this.ProjectId;
                this.ctlAuditFlow.UnitId    = this.CurrUser.UnitId;
            }
        }
        /// <summary>
        /// 将Dataset的数据导入数据库
        /// </summary>
        /// <param name="pds">数据集</param>
        /// <param name="Cols">数据集行数</param>
        /// <returns></returns>
        private bool AddDatasetToSQL(DataTable pds, int Cols)
        {
            string result = string.Empty;
            int    ic, ir;

            ic = pds.Columns.Count;
            if (ic < Cols)
            {
                ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "行", MessageBoxIcon.Warning);
            }

            ir = pds.Rows.Count;
            if (pds != null && ir > 0)
            {
                for (int i = 1; i < ir; i++)
                {
                    string row1   = pds.Rows[i][0].ToString();
                    string unitId = string.Empty;
                    if (!string.IsNullOrEmpty(row1))
                    {
                        var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == row1.Trim());
                        if (unit == null)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "单位名称" + "," + "[" + row1 + "]不存在!" + "|";
                        }
                        else
                        {
                            unitId = unit.UnitId;
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "单位名称" + "," + "此项为必填项!" + "|";
                    }

                    string row2 = pds.Rows[i][1].ToString();
                    if (!string.IsNullOrEmpty(row2))
                    {
                        try
                        {
                            Int32 year = Convert.ToInt32(row2.Trim());
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "年份" + "," + "[" + row2 + "]错误!" + "|";
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "年份" + "," + "此项为必填项!" + "|";
                    }

                    string row3 = pds.Rows[i][2].ToString();
                    if (!string.IsNullOrEmpty(row3))
                    {
                        try
                        {
                            Int32 month = Convert.ToInt32(row3.Trim());
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "季度" + "," + "[" + row3 + "]错误!" + "|";
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "季度" + "," + "此项为必填项!" + "|";
                    }

                    ////判断是否 已存在该季度数据
                    var drillConductedQuarterlyReport = BLL.DrillConductedQuarterlyReportService.GetDrillConductedQuarterlyReportByUnitIdAndYearAndQuarters(unitId, Funs.GetNewIntOrZero(row2.Trim()), Funs.GetNewIntOrZero(row3.Trim()));
                    if (drillConductedQuarterlyReport != null)
                    {
                        result += "第" + (i + 2).ToString() + "行," + "已存在该季度季报!" + "|";
                    }

                    string row5 = pds.Rows[i][4].ToString().Trim();
                    if (!string.IsNullOrEmpty(row5))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row5);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "总体情况举办次数" + "," + "[" + row5 + "]错误!" + "|";
                        }
                    }
                    string row6 = pds.Rows[i][5].ToString().Trim();
                    if (!string.IsNullOrEmpty(row6))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row6);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "总体情况参演人数" + "," + "[" + row6 + "]错误!" + "|";
                        }
                    }
                    string row7 = pds.Rows[i][6].ToString().Trim();
                    if (!string.IsNullOrEmpty(row7))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row7);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "总体情况直接投入" + "," + "[" + row7 + "]错误!" + "|";
                        }
                    }
                    string row8 = pds.Rows[i][7].ToString().Trim();
                    if (!string.IsNullOrEmpty(row8))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row8);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "企业总部举办次数" + "," + "[" + row8 + "]错误!" + "|";
                        }
                    }
                    string row9 = pds.Rows[i][8].ToString().Trim();
                    if (!string.IsNullOrEmpty(row9))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row9);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "企业总部参演人数" + "," + "[" + row9 + "]错误!" + "|";
                        }
                    }
                    string row10 = pds.Rows[i][9].ToString().Trim();
                    if (!string.IsNullOrEmpty(row10))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row10);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "企业总部直接投入" + "," + "[" + row10 + "]错误!" + "|";
                        }
                    }
                    string row11 = pds.Rows[i][10].ToString().Trim();
                    if (!string.IsNullOrEmpty(row11))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row11);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "基层单位举办次数" + "," + "[" + row11 + "]错误!" + "|";
                        }
                    }
                    string row12 = pds.Rows[i][11].ToString().Trim();
                    if (!string.IsNullOrEmpty(row12))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row12);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "基层单位参演人数" + "," + "[" + row12 + "]错误!" + "|";
                        }
                    }
                    string row13 = pds.Rows[i][12].ToString().Trim();
                    if (!string.IsNullOrEmpty(row13))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row13);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "基层单位直接投入" + "," + "[" + row13 + "]错误!" + "|";
                        }
                    }
                    string row14 = pds.Rows[i][13].ToString().Trim();
                    if (!string.IsNullOrEmpty(row14))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row14);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "综合演练" + "," + "[" + row14 + "]错误!" + "|";
                        }
                    }
                    string row15 = pds.Rows[i][14].ToString().Trim();
                    if (!string.IsNullOrEmpty(row15))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row15);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "综合演练其中现场" + "," + "[" + row15 + "]错误!" + "|";
                        }
                    }
                    string row16 = pds.Rows[i][15].ToString().Trim();
                    if (!string.IsNullOrEmpty(row16))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row16);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "综合演练其中桌面" + "," + "[" + row16 + "]错误!" + "|";
                        }
                    }

                    string row17 = pds.Rows[i][16].ToString().Trim();
                    if (!string.IsNullOrEmpty(row17))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row17);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "专项演练" + "," + "[" + row17 + "]错误!" + "|";
                        }
                    }
                    string row18 = pds.Rows[i][17].ToString().Trim();
                    if (!string.IsNullOrEmpty(row18))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row18);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "专项演练其中现场" + "," + "[" + row18 + "]错误!" + "|";
                        }
                    }
                    string row19 = pds.Rows[i][18].ToString().Trim();
                    if (!string.IsNullOrEmpty(row19))
                    {
                        try
                        {
                            Decimal deathAccidentFrequency = Convert.ToDecimal(row19);
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "专项演练其中桌面" + "," + "[" + row19 + "]错误!" + "|";
                        }
                    }
                }
                if (!string.IsNullOrEmpty(result))
                {
                    result = result.Substring(0, result.LastIndexOf("|"));
                    ShowNotify(result, MessageBoxIcon.Warning);
                    //Session["errorInfos"] = result;
                }
                else
                {
                    ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
                }
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            }
            else
            {
                ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
            }
            return(true);
        }
예제 #18
0
 /// <summary>
 /// 查询
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void TextBox_TextChanged(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.txtStartRectificationTime.Text.Trim()) && !string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim()))
     {
         if (Funs.GetNewDateTime(this.txtStartRectificationTime.Text.Trim()) > Funs.GetNewDateTime(this.txtEndRectificationTime.Text.Trim()))
         {
             Alert.ShowInTop("开始时间不能大于结束时间!", MessageBoxIcon.Warning);
             return;
         }
     }
     this.BindGrid();
 }
예제 #19
0
        /// <summary>
        /// 扫描文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnImageMagnify_Click(object sender, EventArgs e)
        {
            try
            {
                DeviceManager manager = new DeviceManagerClass();
                Device        device  = null;
                foreach (DeviceInfo info in manager.DeviceInfos)
                {
                    if (info.Type != WiaDeviceType.ScannerDeviceType)
                    {
                        continue;
                    }
                    device = info.Connect();
                    break;
                }
                Item item                   = device.Items[1];
                CommonDialogClass cdc       = new WIA.CommonDialogClass();
                ImageFile         imageFile = null;
                imageFile = cdc.ShowAcquireImage(WIA.WiaDeviceType.ScannerDeviceType,
                                                 WIA.WiaImageIntent.TextIntent,
                                                 WIA.WiaImageBias.MaximizeQuality,
                                                 "{00000000-0000-0000-0000-000000000000}",
                                                 true,
                                                 true,
                                                 false);
                if (imageFile != null)
                {
                    var buffer = imageFile.FileData.get_BinaryData() as byte[];
                    using (MemoryStream ms = new MemoryStream())
                    {
                        ms.Write(buffer, 0, buffer.Length);
                        string filePath = Server.MapPath("~/") + AttachPath;  ///文件夹
                        if (!Directory.Exists(filePath))
                        {
                            Directory.CreateDirectory(filePath);
                        }
                        string name = "\\";
                        var    menu = BLL.SysMenuService.GetSysMenuByMenuId(this.MenuId);
                        if (menu != null)
                        {
                            name += menu.MenuName;
                        }
                        name += Funs.GetNewFileName() + ".jpg";
                        string url = filePath + name;
                        if (!string.IsNullOrEmpty(url))
                        {
                            using (FileStream fs = new FileStream(url, FileMode.Create, FileAccess.Write))
                            {
                                ms.WriteTo(fs);
                                string attachUrl = AttachPath + name;
                                if (!string.IsNullOrEmpty(attachUrl))
                                {
                                    attachUrl = attachUrl.Replace('/', '\\');
                                }
                                string           oldSrouce = string.Empty;
                                string           FullPath  = string.Empty;
                                Model.AttachFile att       = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.ToKeyId);
                                if (att != null && !string.IsNullOrEmpty(att.AttachUrl))
                                {
                                    FullPath  = att.AttachUrl + "," + attachUrl;
                                    oldSrouce = att.AttachSource;
                                }
                                else
                                {
                                    FullPath = attachUrl;
                                }
                                string source = BLL.UploadFileService.GetSourceByAttachUrl(attachUrl, buffer.Length, oldSrouce);
                                //this.SaveData(source, FullPath); ///保存方法
                                Session[sessionName] = JArray.Parse(source);
                            }

                            this.BindGrid();
                            ShowNotify("扫描完成!", MessageBoxIcon.Success);
                        }
                    }
                }
            }
            catch
            {
                ShowNotify("请检查扫描仪是否连接正确!", MessageBoxIcon.Warning);
            }
        }
예제 #20
0
        /// <summary>
        ///  初始化菜单输入框信息
        /// </summary>
        private void InitTextUnitValue(Model.CostGoods_HSSECostUnitManage hsseCostUnitManage)
        {
            decimal? a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0, a7 = 0, a8 = 0, aall = 0;
            decimal? pa1 = 0, pa2 = 0, pa3 = 0, pa4 = 0, pa5 = 0, pa6 = 0, pa7 = 0, pa8 = 0, paall = 0;
            decimal? EngineeringCost = 0, SubUnitCost = 0, AuditedSubUnitCost = 0;
            decimal? pEngineeringCost = 0, pSubUnitCost = 0, pAuditedSubUnitCost = 0;
            string   remark1 = string.Empty, remark2 = string.Empty, remark3 = string.Empty, remark4 = string.Empty;
            DateTime?Months  = Funs.GetNewDateTime(this.drpYear.SelectedValue + "-" + this.drpMonths.SelectedValue);
            var      sumUnit = BLL.HSSECostUnitManageService.GetHSSECostUnitManageListByProjectIdUnitIdMonth(this.ProjectId, this.drpUnitId.SelectedValue, Months);

            if (sumUnit.Count() > 0)
            {
                pa1                 = sumUnit.Sum(x => x.RatifiedCostA1);
                pa2                 = sumUnit.Sum(x => x.RatifiedCostA2);
                pa3                 = sumUnit.Sum(x => x.RatifiedCostA3);
                pa4                 = sumUnit.Sum(x => x.RatifiedCostA4);
                pa5                 = sumUnit.Sum(x => x.RatifiedCostA5);
                pa6                 = sumUnit.Sum(x => x.RatifiedCostA6);
                pa7                 = sumUnit.Sum(x => x.RatifiedCostA7);
                pa8                 = sumUnit.Sum(x => x.RatifiedCostA8);
                paall               = pa1 + pa2 + pa3 + pa4 + pa5 + pa6 + pa7 + pa8;
                pEngineeringCost    = sumUnit.Sum(x => EngineeringCost ?? 0);
                pSubUnitCost        = sumUnit.Sum(x => SubUnitCost ?? 0);
                pAuditedSubUnitCost = sumUnit.Sum(x => AuditedSubUnitCost ?? 0);
            }

            if (hsseCostUnitManage != null)
            {
                this.HSSECostUnitManageId = hsseCostUnitManage.HSSECostUnitManageId;
                a1                = hsseCostUnitManage.RatifiedCostA1;
                pa1              += a1;
                aall             += a1;
                a2                = hsseCostUnitManage.RatifiedCostA2;
                pa2              += a2;
                aall             += a2;
                a3                = hsseCostUnitManage.RatifiedCostA3;
                pa3              += a3;
                aall             += a3;
                a4                = hsseCostUnitManage.RatifiedCostA4;
                pa4              += a4;
                aall             += a4;
                a5                = hsseCostUnitManage.RatifiedCostA5;
                pa5              += a5;
                aall             += a5;
                a6                = hsseCostUnitManage.RatifiedCostA6;
                pa6              += a6;
                aall             += a6;
                a7                = hsseCostUnitManage.RatifiedCostA7;
                pa7              += a7;
                aall             += a7;
                a8                = hsseCostUnitManage.RatifiedCostA8;
                pa8              += a8;
                aall             += a8;
                paall            += aall;
                EngineeringCost   = hsseCostUnitManage.EngineeringCost;
                pEngineeringCost += EngineeringCost;

                SubUnitCost   = hsseCostUnitManage.SubUnitCost;
                pSubUnitCost += SubUnitCost;

                AuditedSubUnitCost   = hsseCostUnitManage.AuditedSubUnitCost;
                pAuditedSubUnitCost += AuditedSubUnitCost;

                remark1 = hsseCostUnitManage.Remark1;
                remark2 = hsseCostUnitManage.Remark2;
                remark3 = hsseCostUnitManage.Remark3;
                remark4 = hsseCostUnitManage.Remark4;
            }

            this.txtA1.Text   = a1.ToString();
            this.txtA2.Text   = a2.ToString();
            this.txtA3.Text   = a3.ToString();
            this.txtA4.Text   = a4.ToString();
            this.txtA5.Text   = a5.ToString();
            this.txtA6.Text   = a6.ToString();
            this.txtA7.Text   = a7.ToString();
            this.txtA8.Text   = a8.ToString();
            this.txtAAll.Text = aall.ToString();

            this.txtProjectA1.Text   = pa1.ToString();
            this.txtProjectA2.Text   = pa2.ToString();
            this.txtProjectA3.Text   = pa3.ToString();
            this.txtProjectA4.Text   = pa4.ToString();
            this.txtProjectA5.Text   = pa5.ToString();
            this.txtProjectA6.Text   = pa6.ToString();
            this.txtProjectA7.Text   = pa7.ToString();
            this.txtProjectA8.Text   = pa8.ToString();
            this.txtProjectAAll.Text = paall.ToString();

            this.txtEngineeringCost.Text    = EngineeringCost.ToString();
            this.txtSubUnitCost.Text        = SubUnitCost.ToString();
            this.txtAuditedSubUnitCost.Text = AuditedSubUnitCost.ToString();

            this.txtUnitRemark1.Text = remark1;
            this.txtUnitRemark2.Text = remark2;
            this.txtUnitRemark3.Text = remark3;
            this.txtUnitRemark4.Text = remark4;

            this.txtProjectEngineeringCost.Text    = pEngineeringCost.ToString();
            this.txtProjectSubUnitCost.Text        = pSubUnitCost.ToString();
            this.txtProjectAuditedSubUnitCost.Text = pAuditedSubUnitCost.ToString();
            if (EngineeringCost.HasValue && EngineeringCost != 0 && AuditedSubUnitCost.HasValue)
            {
                this.txtCostRatio.Text = Math.Round((AuditedSubUnitCost / EngineeringCost * 100).Value, 2).ToString() + "%";
            }
            else
            {
                this.txtCostRatio.Text = "0%";
            }

            if (pEngineeringCost.HasValue && pEngineeringCost != 0 && pAuditedSubUnitCost.HasValue)
            {
                this.txtProjectCostRatio.Text = Math.Round((pAuditedSubUnitCost / pEngineeringCost * 100).Value, 2).ToString() + "%";
            }
            else
            {
                this.txtProjectCostRatio.Text = "0%";
            }
        }
예제 #21
0
        /// <summary>
        /// 加载页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
                this.IncentiveNoticeId      = Request.Params["IncentiveNoticeId"];
                this.txtCurrency.Text       = "人民币";
                if (!string.IsNullOrEmpty(this.IncentiveNoticeId))
                {
                    Model.Check_IncentiveNotice incentiveNotice = BLL.IncentiveNoticeService.GetIncentiveNoticeById(this.IncentiveNoticeId);
                    if (incentiveNotice != null)
                    {
                        this.txtIncentiveNoticeCode.Text = CodeRecordsService.ReturnCodeByDataId(this.IncentiveNoticeId);
                        if (!string.IsNullOrEmpty(incentiveNotice.UnitId))
                        {
                            var unit = UnitService.GetUnitByUnitId(incentiveNotice.UnitId);
                            if (unit != null)
                            {
                                this.txtUnitName.Text = unit.UnitName;
                            }
                        }
                        if (!string.IsNullOrEmpty(incentiveNotice.TeamGroupId))
                        {
                            var teamGroup = TeamGroupService.GetTeamGroupById(incentiveNotice.TeamGroupId);
                            if (teamGroup != null)
                            {
                                this.txtTeamGroup.Text = teamGroup.TeamGroupName;
                            }
                        }
                        if (!string.IsNullOrEmpty(incentiveNotice.PersonId))
                        {
                            var person = BLL.PersonService.GetPersonById(incentiveNotice.PersonId);
                            if (person != null)
                            {
                                this.txtPerson.Text = person.PersonName;
                            }
                        }

                        if (incentiveNotice.IncentiveDate != null)
                        {
                            this.txtIncentiveDate.Text = string.Format("{0:yyyy-MM-dd}", incentiveNotice.IncentiveDate);
                        }
                        this.txtBasicItem.Text = incentiveNotice.BasicItem;
                        if (!string.IsNullOrEmpty(incentiveNotice.RewardType))
                        {
                            Model.Sys_Const c = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_RewardType).FirstOrDefault(x => x.ConstValue == incentiveNotice.RewardType);
                            if (c != null)
                            {
                                this.txtRewardType.Text = c.ConstText;
                            }
                        }
                        if (incentiveNotice.IncentiveMoney != null)
                        {
                            this.txtPayMoney.Text          = Convert.ToString(incentiveNotice.IncentiveMoney);
                            this.rbtnIncentiveWay1.Checked = true;
                            this.txtBig.Text = Funs.NumericCapitalization(Funs.GetNewDecimalOrZero(txtPayMoney.Text));//转换大写
                        }
                        if (!string.IsNullOrEmpty(incentiveNotice.TitleReward))
                        {
                            this.txtTitleReward.Text       = incentiveNotice.TitleReward;
                            this.rbtnIncentiveWay2.Checked = true;
                        }
                        if (!string.IsNullOrEmpty(incentiveNotice.MattleReward))
                        {
                            this.txtMattleReward.Text      = incentiveNotice.MattleReward;
                            this.rbtnIncentiveWay3.Checked = true;
                        }
                        this.AttachUrl            = incentiveNotice.AttachUrl;
                        this.divFile.InnerHtml    = BLL.UploadAttachmentService.ShowAttachment("../", this.AttachUrl);
                        this.txtFileContents.Text = HttpUtility.HtmlDecode(incentiveNotice.FileContents);
                        if (!string.IsNullOrEmpty(incentiveNotice.Currency))
                        {
                            this.txtCurrency.Text = incentiveNotice.Currency;
                        }
                    }
                }
                ///初始化审核菜单
                this.ctlAuditFlow.MenuId = BLL.Const.ProjectIncentiveNoticeMenuId;
                this.ctlAuditFlow.DataId = this.IncentiveNoticeId;
            }
        }
예제 #22
0
        /// <summary>
        ///
        /// </summary>
        private void SaveData(string type)
        {
            ///添加安全费用
            DateTime?Months = Funs.GetNewDateTime(this.drpYear.SelectedValue + "-" + this.drpMonths.SelectedValue);

            Model.CostGoods_HSSECostManage newHSSECostManage = new Model.CostGoods_HSSECostManage
            {
                ProjectId          = this.ProjectId,
                Month              = Months,
                Code               = this.txtCode.Text,
                ReportDate         = Funs.GetNewDateTime(this.txtReportDate.Text),
                MainIncome         = Funs.GetNewDecimal(this.txtMainIncome.Text),
                Remark1            = this.txtRemark1.Text,
                ConstructionIncome = Funs.GetNewDecimal(this.txtConstructionIncome.Text),
                Remark2            = this.txtRemark2.Text,
                SafetyCosts        = Funs.GetNewDecimal(this.txtSafetyCosts.Text),
                Remark3            = this.txtRemark3.Text,
            };

            ////单据状态
            newHSSECostManage.States = BLL.Const.State_0;
            if (type == BLL.Const.BtnSubmit)
            {
                newHSSECostManage.States = this.ctlAuditFlow.NextStep;
            }

            if (!string.IsNullOrEmpty(this.HSSECostManageId))
            {
                newHSSECostManage.HSSECostManageId = this.HSSECostManageId;
                BLL.HSSECostManageService.UpdateHSSECostManage(newHSSECostManage);
                BLL.LogService.AddSys_Log(this.CurrUser, newHSSECostManage.Code, newHSSECostManage.HSSECostManageId, BLL.Const.ProjectHSSECostManageMenuId, BLL.Const.BtnModify);
            }
            else
            {
                this.HSSECostManageId = SQLHelper.GetNewID(typeof(Model.CostGoods_HSSECostManage));
                newHSSECostManage.HSSECostManageId = this.HSSECostManageId;
                newHSSECostManage.CompileDate      = System.DateTime.Now;
                newHSSECostManage.CompileManId     = this.CurrUser.UserId;
                BLL.HSSECostManageService.AddHSSECostManage(newHSSECostManage);
                BLL.LogService.AddSys_Log(this.CurrUser, newHSSECostManage.Code, newHSSECostManage.HSSECostManageId, BLL.Const.ProjectHSSECostManageMenuId, BLL.Const.BtnAdd);
            }

            if (!string.IsNullOrEmpty(this.drpUnitId.SelectedValue) && this.drpUnitId.SelectedValue != BLL.Const._Null)
            {
                var updateItem = BLL.HSSECostUnitManageService.GetHSSECostUnitManageByHSSECostUnitManageId(this.HSSECostUnitManageId);
                if (updateItem != null)
                {
                    updateItem.HSSECostManageId   = this.HSSECostManageId;
                    updateItem.UnitId             = this.drpUnitId.SelectedValue;
                    updateItem.EngineeringCost    = Funs.GetNewDecimal(this.txtEngineeringCost.Text);
                    updateItem.Remark1            = this.txtRemark1.Text;
                    updateItem.SubUnitCost        = Funs.GetNewDecimal(this.txtSubUnitCost.Text);
                    updateItem.Remark2            = this.txtRemark2.Text;
                    updateItem.AuditedSubUnitCost = Funs.GetNewDecimal(this.txtAuditedSubUnitCost.Text);
                    updateItem.Remark3            = this.txtRemark1.Text;
                    updateItem.CostRatio          = Funs.GetNewDecimal(this.txtCostRatio.Text);
                    updateItem.Remark4            = this.txtRemark1.Text;
                    BLL.HSSECostUnitManageService.UpdateHSSECostUnitManage(updateItem);
                }
                else
                {
                    ///添加施工单位安全费用
                    Model.CostGoods_HSSECostUnitManage newHSSECostUnitManage = new Model.CostGoods_HSSECostUnitManage
                    {
                        HSSECostManageId   = this.HSSECostManageId,
                        UnitId             = this.drpUnitId.SelectedValue,
                        EngineeringCost    = Funs.GetNewDecimal(this.txtEngineeringCost.Text),
                        Remark1            = this.txtRemark1.Text,
                        SubUnitCost        = Funs.GetNewDecimal(this.txtSubUnitCost.Text),
                        Remark2            = this.txtRemark2.Text,
                        AuditedSubUnitCost = Funs.GetNewDecimal(this.txtAuditedSubUnitCost.Text),
                        Remark3            = this.txtRemark1.Text,
                        CostRatio          = Funs.GetNewDecimal(this.txtCostRatio.Text),
                        Remark4            = this.txtRemark1.Text,
                    };

                    this.HSSECostUnitManageId = SQLHelper.GetNewID(typeof(Model.CostGoods_HSSECostUnitManage));
                    newHSSECostUnitManage.HSSECostUnitManageId = this.HSSECostUnitManageId;
                    BLL.HSSECostUnitManageService.AddHSSECostUnitManage(newHSSECostUnitManage);
                }

                this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectHSSECostManageMenuId, this.HSSECostManageId, (type == BLL.Const.BtnSubmit ? true : false), this.drpYear.SelectedText + "年" + this.drpMonths.SelectedText + "月安全费用", "../CostGoods/HSSECostManageView.aspx?HSSECostManageId={0}");
                ////判断单据是否 加入到企业管理资料
                string menuId   = BLL.Const.ProjectHSSECostManageMenuId;
                var    safeData = Funs.DB.SafetyData_SafetyData.FirstOrDefault(x => x.MenuId == menuId);
                if (safeData != null)
                {
                    BLL.SafetyDataService.AddSafetyData(menuId, this.HSSECostManageId, this.drpYear.SelectedText + "-" + this.drpMonths.SelectedText + "安全费用", "../CostGoods/HSSECostManageView.aspx?HSSECostManageId={0}", this.ProjectId);
                }
            }
        }
예제 #23
0
 public JsonResult Add(Funs model)
 {
     FunsContainer.GlobalFuns = null;
     return(Json(FunsService.Add(model)));
 }
예제 #24
0
        public static void AutoCode(List <string> classes)
        {
            // 自动生成所有需要委托
            Dictionary <string, Funs> allfuns = new Dictionary <string, Funs>(); // 所有的需要导出的函数原形列表

            var flag = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.DeclaredOnly;
            var alls = new List <System.Type>();

            HashSet <int>    ObjectsParamCount = new HashSet <int>();
            HashSet <string> exports           = new HashSet <string>(classes);

            foreach (var ator in System.AppDomain.CurrentDomain.GetAssemblies().Select((assemblies) => assemblies.GetTypes()))
            {
                foreach (var type in ator)
                {
                    if (exports.Contains(type.FullName.Replace('+', '/')) || type.GetCustomAttributes(typeof(HotfixAttribute), false).Length != 0)
                    {
                        //Debug.LogFormat("type:{0}", type.FullName);
                        if (type.IsGenericType)
                        {
                            continue;
                        }

                        foreach (var method in type.GetMethods(flag))
                        {
                            if (method.IsGenericMethod)
                            {
                                continue;
                            }

                            Funs fun = new Funs(method, method.IsStatic ? false : true);
                            if (!fun.isExport)
                            {
                                continue;
                            }

                            string key = fun.oid;
                            Funs   rs;
                            if (allfuns.TryGetValue(key, out rs))
                            {
                                rs.methods.Add(method);
                                continue;
                            }

                            allfuns.Add(key, fun);
                        }

                        // MonoBehaviour类型不重载构造函数
                        if (IsUnityObjectType(type))
                        {
                            continue;
                        }

                        foreach (var ctor in type.GetConstructors(flag))
                        {
                            if (ctor.IsGenericMethod)
                            {
                                continue;
                            }

                            Funs fun = new Funs(ctor, ctor.IsStatic ? false : true);
                            if (!fun.isExport)
                            {
                                continue;
                            }

                            string key = fun.oid;
                            Funs   rs;
                            if (allfuns.TryGetValue(key, out rs))
                            {
                                rs.methods.Add(ctor);
                                continue;
                            }

                            allfuns.Add(key, fun);
                        }
                    }
                }
            }

#if UNITY_IOS
            string marco = "UNITY_IOS";
            string file  = "Assets/XIL/Auto/GenDelegateBridge_ios.cs";
#elif UNITY_ANDROID
            string marco = "UNITY_ANDROID";
            string file  = "Assets/XIL/Auto/GenDelegateBridge_ad.cs";
#else
            string marco = "UNITY_STANDALONE_WIN";
            string file  = "Assets/XIL/Auto/GenDelegateBridge_pc.cs";
#endif
            System.IO.Directory.CreateDirectory(file.Substring(0, file.LastIndexOf('/')));

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            string name  = "__Gen_Delegate_Imp";
            int    index = 0;
            foreach (var ator in allfuns)
            {
                ator.Value.toInfo("        ", sb);
                int paramCount = 0;
                sb.AppendFormat("        {0}", ator.Value.toString(name + (++index), out paramCount));
                sb.AppendLine();
                if (paramCount != 0)
                {
                    ObjectsParamCount.Add(paramCount);
                }
            }

            System.IO.File.WriteAllText(file, string.Format(file_format + "#endif", marco, sb.ToString()));
            Debug.LogFormat("count:{0}", allfuns.Count);

            sb.Length = 0;
            sb.AppendLine(string.Format("countType:{0}", classes.Count));
            foreach (var ator in classes)
            {
                sb.AppendLine(ator);
            }
            Debug.LogFormat(sb.ToString());

            GeneratorObjects.Gen(ObjectsParamCount);
            AssetDatabase.Refresh();
        }
예제 #25
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnNew_Click(object sender, EventArgs e)
        {
            if (this.drpYear.SelectedValue != BLL.Const._Null && this.drpMonths.SelectedValue != BLL.Const._Null &&
                this.drpUnitId.SelectedValue != BLL.Const._Null && this.drpUnitId.SelectedValue != BLL.Const._Null)
            {
                DateTime?Months           = Funs.GetNewDateTime(this.drpYear.SelectedValue + "-" + this.drpMonths.SelectedValue);
                string   hsseCostManageId = string.Empty;
                string   unitId           = this.drpUnitId.SelectedValue;
                var      hsseCost         = BLL.HSSECostManageService.GetHSSECostManageByProjectIdMonth(this.ProjectId, Funs.GetNewIntOrZero(this.drpYear.SelectedValue), Funs.GetNewIntOrZero(this.drpMonths.SelectedValue));
                if (hsseCost != null)
                {
                    hsseCostManageId = hsseCost.HSSECostManageId;
                }
                else
                {
                    hsseCostManageId = SQLHelper.GetNewID(typeof(Model.CostGoods_HSSECostManage));
                    Model.CostGoods_HSSECostManage newHSSECostManage = new Model.CostGoods_HSSECostManage
                    {
                        HSSECostManageId = hsseCostManageId,
                        ProjectId        = this.ProjectId,
                        Month            = Months,
                        Code             = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectHSSECostManageMenuId, this.ProjectId, string.Empty),
                        ReportDate       = System.DateTime.Now,
                        CompileDate      = System.DateTime.Now,
                    };

                    BLL.HSSECostManageService.AddHSSECostManage(newHSSECostManage);
                }
                var unitCost = BLL.HSSECostUnitManageService.GetHSSECostUnitManageByHSSECostManageIdUnitId(hsseCostManageId, unitId);
                if (unitCost == null)
                {
                    string HSSECostUnitManageId = SQLHelper.GetNewID(typeof(Model.CostGoods_HSSECostUnitManage));
                    Model.CostGoods_HSSECostUnitManage newHSSECostUnit = new Model.CostGoods_HSSECostUnitManage
                    {
                        HSSECostUnitManageId = HSSECostUnitManageId,
                        HSSECostManageId     = hsseCostManageId,
                        UnitId       = unitId,
                        StateType    = "1",
                        States       = "0",
                        CompileManId = this.CurrUser.UserId,
                        CompileDate  = DateTime.Now,
                        CostA1       = 0,
                        CostA2       = 0,
                        CostA3       = 0,
                        CostA4       = 0,
                        CostA5       = 0,
                        CostA6       = 0,
                        CostA7       = 0,
                        CostA8       = 0,
                        CostB1       = 0,
                        CostB2       = 0,
                        CostC1       = 0,
                        CostD1       = 0,
                        CostD2       = 0,
                        CostD3       = 0,
                    };

                    BLL.HSSECostUnitManageService.AddHSSECostUnitManage(newHSSECostUnit);

                    PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("HSSECostUnitManageEdit.aspx?HSSECostUnitManageId={0}", HSSECostUnitManageId, "编辑 - ")));
                }
                else
                {
                    Alert.ShowInTop("当月已存在费用表!", MessageBoxIcon.Warning);
                }
            }
            else
            {
                Alert.ShowInTop("请选择月份、单位!", MessageBoxIcon.Warning);
            }
        }
예제 #26
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="type"></param>
        private void SaveData(string type)
        {
            if (string.IsNullOrEmpty(this.drpUnitId.SelectedValue))
            {
                Alert.ShowInTop("请选择受罚单位", MessageBoxIcon.Warning);
                return;
            }

            Model.Check_PunishNotice punishNotice = new Model.Check_PunishNotice
            {
                ProjectId        = this.ProjectId,
                PunishNoticeCode = this.txtPunishNoticeCode.Text.Trim()
            };
            if (!string.IsNullOrEmpty(this.drpUnitId.SelectedValue))
            {
                punishNotice.UnitId = this.drpUnitId.SelectedValue;
            }
            punishNotice.PunishName       = this.drpPunishName.SelectedValue;
            punishNotice.PunishNoticeDate = Funs.GetNewDateTime(this.txtPunishNoticeDate.Text.Trim());
            punishNotice.IncentiveReason  = this.txtIncentiveReason.Text.Trim();
            punishNotice.BasicItem        = this.txtBasicItem.Text.Trim();
            punishNotice.PunishMoney      = Funs.GetNewDecimalOrZero(this.txtPunishMoney.Text.Trim());
            punishNotice.FileContents     = HttpUtility.HtmlEncode(this.txtFileContents.Text);
            //punishNotice.AttachUrl = this.AttchUrl;
            punishNotice.CompileMan  = this.CurrUser.UserId;
            punishNotice.CompileDate = DateTime.Now;
            punishNotice.States      = Const.State_0;
            if (this.drpSignMan.SelectedValue != BLL.Const._Null)
            {
                punishNotice.SignMan = this.drpSignMan.SelectedValue;
            }
            if (this.drpApproveMan.SelectedValue != BLL.Const._Null)
            {
                punishNotice.ApproveMan = this.drpApproveMan.SelectedValue;
            }
            punishNotice.ContractNum = this.txtContractNum.Text.Trim();
            punishNotice.Currency    = this.txtCurrency.Text.Trim();
            if (type == BLL.Const.BtnSubmit)
            {
                punishNotice.States = this.ctlAuditFlow.NextStep;
            }
            punishNotice.PunishStates = punishNotice.States;
            if (punishNotice.States == Const.State_2)
            {
                punishNotice.PunishStates = Const.State_4;
            }
            if (!string.IsNullOrEmpty(this.PunishNoticeId))
            {
                punishNotice.PunishNoticeId = this.PunishNoticeId;
                BLL.PunishNoticeService.UpdatePunishNotice(punishNotice);
                BLL.LogService.AddSys_Log(this.CurrUser, punishNotice.PunishNoticeCode, punishNotice.PunishNoticeId, BLL.Const.ProjectPunishNoticeMenuId, BLL.Const.BtnModify);
            }
            else
            {
                this.PunishNoticeId         = SQLHelper.GetNewID(typeof(Model.Check_PunishNotice));
                punishNotice.PunishNoticeId = this.PunishNoticeId;
                BLL.PunishNoticeService.AddPunishNotice(punishNotice);
                BLL.LogService.AddSys_Log(this.CurrUser, punishNotice.PunishNoticeCode, punishNotice.PunishNoticeId, BLL.Const.ProjectPunishNoticeMenuId, BLL.Const.BtnAdd);
            }
            ////保存流程审核数据
            this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectPunishNoticeMenuId, this.PunishNoticeId, (type == BLL.Const.BtnSubmit ? true : false), punishNotice.PunishNoticeCode, "../Check/PunishNoticeView.aspx?PunishNoticeId={0}");
        }
        /// <summary>
        /// 将Dataset的数据导入数据库
        /// </summary>
        /// <param name="pds">数据集</param>
        /// <param name="Cols">数据集行数</param>
        /// <returns></returns>
        private bool AddDatasetToSQL(DataTable pds, int Cols)
        {
            string result = string.Empty;
            int    ic, ir;

            ic = pds.Columns.Count;
            if (ic < Cols)
            {
                ShowNotify("导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "行", MessageBoxIcon.Warning);
            }

            ir = pds.Rows.Count;
            if (pds != null && ir > 0)
            {
                for (int i = 0; i < ir; i++)
                {
                    string row1   = pds.Rows[i][0].ToString();
                    string unitId = string.Empty;
                    if (!string.IsNullOrEmpty(row1))
                    {
                        var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == row1.Trim());
                        if (unit == null)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "单位名称" + "," + "[" + row1 + "]不存在!" + "|";
                        }
                        else
                        {
                            unitId = unit.UnitId;
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "单位名称" + "," + "此项为必填项!" + "|";
                    }

                    string row2 = pds.Rows[i][1].ToString();
                    if (!string.IsNullOrEmpty(row2))
                    {
                        try
                        {
                            Int32 year = Convert.ToInt32(row2.Trim());
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "年份" + "," + "[" + row2 + "]错误!" + "|";
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "年份" + "," + "此项为必填项!" + "|";
                    }

                    string row3 = pds.Rows[i][2].ToString();
                    if (!string.IsNullOrEmpty(row3))
                    {
                        try
                        {
                            Int32 month = Convert.ToInt32(row3.Trim());
                        }
                        catch (Exception)
                        {
                            result += "第" + (i + 2).ToString() + "行," + "半年度" + "," + "[" + row3 + "]错误!" + "|";
                        }
                    }
                    else
                    {
                        result += "第" + (i + 2).ToString() + "行," + "半年度" + "," + "此项为必填项!" + "|";
                    }

                    ////判断是否 已存在该半年数据
                    var drillPlanHalfYearReport = BLL.DrillPlanHalfYearReportService.GetDrillPlanHalfYearReportByUnitIdAndYearAndHalfYear(unitId, Funs.GetNewIntOrZero(row2.Trim()), Funs.GetNewIntOrZero(row3.Trim()));
                    if (drillPlanHalfYearReport != null)
                    {
                        result += "第" + (i + 2).ToString() + "行," + "已存在该半年度半年报!" + "|";
                    }
                }

                if (!string.IsNullOrEmpty(result))
                {
                    result = result.Substring(0, result.LastIndexOf("|"));
                    ShowNotify(result, MessageBoxIcon.Warning);
                    //Session["errorInfos"] = result;
                }
                else
                {
                    ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
                }
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            }
            else
            {
                ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
            }
            return(true);
        }
예제 #28
0
        ///// <summary>
        ///// 附件
        ///// </summary>
        //private string AttchUrl
        //{
        //    get
        //    {
        //        return (string)ViewState["AttchUrl"];
        //    }
        //    set
        //    {
        //        ViewState["AttchUrl"] = value;
        //    }
        //}
        #endregion

        #region 加载
        /// <summary>
        /// 加载页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.ProjectId = this.CurrUser.LoginProjectId;
                this.btnClose.OnClientClick = ActiveWindow.GetHideReference();

                this.InitDropDownList();
                this.PunishNoticeId   = Request.Params["PunishNoticeId"];
                this.txtCurrency.Text = "人民币";
                if (!string.IsNullOrEmpty(this.PunishNoticeId))
                {
                    Model.Check_PunishNotice punishNotice = BLL.PunishNoticeService.GetPunishNoticeById(this.PunishNoticeId);
                    if (punishNotice != null)
                    {
                        this.ProjectId = punishNotice.ProjectId;
                        if (this.ProjectId != this.CurrUser.LoginProjectId)
                        {
                            this.InitDropDownList();
                        }
                        this.txtPunishNoticeCode.Text = CodeRecordsService.ReturnCodeByDataId(this.PunishNoticeId);
                        this.txtPunishNoticeDate.Text = string.Format("{0:yyyy-MM-dd}", punishNotice.PunishNoticeDate);
                        if (!string.IsNullOrEmpty(punishNotice.UnitId))
                        {
                            this.drpUnitId.SelectedValue = punishNotice.UnitId;
                        }
                        this.txtIncentiveReason.Text = punishNotice.IncentiveReason;
                        this.txtBasicItem.Text       = punishNotice.BasicItem;
                        if (punishNotice.PunishMoney.HasValue)
                        {
                            this.txtPunishMoney.Text = Convert.ToString(punishNotice.PunishMoney);
                            this.txtBig.Text         = Funs.NumericCapitalization(Funs.GetNewDecimalOrZero(txtPunishMoney.Text));
                        }
                        //this.AttchUrl = punishNotice.AttachUrl;
                        //this.divFile.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../", this.AttchUrl);
                        this.txtFileContents.Text = HttpUtility.HtmlDecode(punishNotice.FileContents);
                        if (!string.IsNullOrEmpty(punishNotice.SignMan))
                        {
                            this.drpSignMan.SelectedValue = punishNotice.SignMan;
                        }
                        if (!string.IsNullOrEmpty(punishNotice.ApproveMan))
                        {
                            this.drpApproveMan.SelectedValue = punishNotice.ApproveMan;
                        }
                        this.txtContractNum.Text = punishNotice.ContractNum;
                        if (!string.IsNullOrEmpty(punishNotice.Currency))
                        {
                            this.txtCurrency.Text = punishNotice.Currency;
                        }

                        this.drpPunishName.SelectedValue = punishNotice.PunishName;
                    }
                }
                else
                {
                    this.drpSignMan.SelectedValue = this.CurrUser.UserId;
                    this.txtPunishNoticeDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
                    var codeTemplateRule = BLL.ProjectData_CodeTemplateRuleService.GetProjectData_CodeTemplateRuleByMenuIdProjectId(BLL.Const.ProjectPunishNoticeMenuId, this.ProjectId);
                    if (codeTemplateRule != null)
                    {
                        this.txtFileContents.Text = HttpUtility.HtmlDecode(codeTemplateRule.Template);
                    }
                    ////自动生成编码
                    this.txtPunishNoticeCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectPunishNoticeMenuId, this.ProjectId, this.CurrUser.UnitId);
                }
                ///初始化审核菜单
                this.ctlAuditFlow.MenuId    = BLL.Const.ProjectPunishNoticeMenuId;
                this.ctlAuditFlow.DataId    = this.PunishNoticeId;
                this.ctlAuditFlow.ProjectId = this.ProjectId;
                this.ctlAuditFlow.UnitId    = this.CurrUser.UnitId;
            }
        }
예제 #29
0
 /// <summary>
 /// 输入框变化事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void nbA4_TextChanged(object sender, EventArgs e)
 {
     if (this.drpUnitId.SelectedValue != BLL.Const._Null)
     {
         this.nbProjectA4.Text = (Funs.GetNewDecimalOrZero(this.hdProjectA4.Text) + Funs.GetNewDecimalOrZero(this.nbA4.Text)).ToString();
         this.nbA.Text         = (Funs.GetNewDecimalOrZero(this.nbA1.Text) + Funs.GetNewDecimalOrZero(this.nbA2.Text) + Funs.GetNewDecimalOrZero(this.nbA3.Text) + Funs.GetNewDecimalOrZero(this.nbA4.Text) + Funs.GetNewDecimalOrZero(this.nbA5.Text) + Funs.GetNewDecimalOrZero(this.nbA6.Text)).ToString();
         this.nbProjectA.Text  = (Funs.GetNewDecimalOrZero(this.nbProjectA1.Text) + Funs.GetNewDecimalOrZero(this.nbProjectA2.Text) + Funs.GetNewDecimalOrZero(this.nbProjectA3.Text) + Funs.GetNewDecimalOrZero(this.nbProjectA4.Text) + Funs.GetNewDecimalOrZero(this.nbProjectA5.Text) + Funs.GetNewDecimalOrZero(this.nbProjectA6.Text)).ToString();
         this.nbAB.Text        = (Funs.GetNewDecimalOrZero(this.nbA.Text) + Funs.GetNewDecimalOrZero(this.nbB.Text)).ToString();
         this.nbProjectAB.Text = (Funs.GetNewDecimalOrZero(this.nbProjectA.Text) + Funs.GetNewDecimalOrZero(this.nbProjectB.Text)).ToString();
     }
     else
     {
         this.nbA4.Text = string.Empty;
         Alert.ShowInTop("请先选择填报单位!", MessageBoxIcon.Warning);
         return;
     }
 }
예제 #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ////自动生成编码
                this.txtRectifyNoticesCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectRectifyNoticesMenuId, this.ProjectId, this.CurrUser.UnitId);
                //受检单位
                BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, Const.ProjectUnitType_2, false);
                //区域
                BLL.WorkAreaService.InitWorkAreaDropDownList(this.drpWorkAreaId, this.CurrUser.LoginProjectId, true);
                ///安全经理
                BLL.UserService.InitFlowOperateControlUserDropDownList(this.drpSignPerson, this.CurrUser.LoginProjectId, BLL.CommonService.GetIsThisUnitId(), true);

                ///检察人员
                BLL.UserService.InitFlowOperateControlUserDropDownList(this.drpCheckPerson, this.CurrUser.LoginProjectId, BLL.CommonService.GetIsThisUnitId(), true);
                RectifyNoticesId = Request.Params["RectifyNoticesId"];
                if (!string.IsNullOrEmpty(RectifyNoticesId))
                {
                    this.hdRectifyNoticesId.Text = RectifyNoticesId;
                    Model.Check_RectifyNotices RectifyNotices = RectifyNoticesService.GetRectifyNoticesById(RectifyNoticesId);
                    if (!string.IsNullOrEmpty(RectifyNotices.UnitId))
                    {
                        this.drpUnitId.SelectedValue = RectifyNotices.UnitId;
                    }
                    if (!string.IsNullOrEmpty(RectifyNotices.WorkAreaId))
                    {
                        this.drpWorkAreaId.SelectedValue = RectifyNotices.WorkAreaId;
                    }
                    if (!string.IsNullOrEmpty(RectifyNotices.CheckManIds))
                    {
                        this.drpCheckPerson.SelectedValueArray = RectifyNotices.CheckManIds.Split(',');
                    }
                    this.txtRectifyNoticesCode.Text = RectifyNotices.RectifyNoticesCode;
                    this.txtCompleteDate.Text       = RectifyNotices.CompleteDate.ToString();
                    if (!string.IsNullOrEmpty(RectifyNotices.HiddenHazardType))
                    {
                        this.drpHiddenHazardType.SelectedValue = RectifyNotices.HiddenHazardType;
                    }
                    if (!string.IsNullOrEmpty(RectifyNotices.States))
                    {
                        State = RectifyNotices.States;
                    }
                    else
                    {
                        State             = "0";
                        this.next1.Hidden = true;
                        this.next2.Hidden = true;
                        this.next3.Hidden = true;
                        this.next4.Hidden = true;
                    }
                    if (State == "0")
                    {
                        this.next1.Hidden = true;
                        this.next2.Hidden = true;
                        this.next3.Hidden = true;
                        this.next4.Hidden = true;
                    }
                    if (State == "1")
                    {
                        this.next.Hidden        = true;
                        this.next2.Hidden       = true;
                        this.next3.Hidden       = true;
                        this.next4.Hidden       = true;
                        this.Itemcontent.Hidden = true;
                        this.btnSure.Hidden     = true;
                        BLL.UserService.InitUserProjectIdUnitIdDropDownList(this.drpDutyPerson, this.CurrUser.LoginProjectId, this.drpUnitId.SelectedValue, true);                     //接收人
                        BLL.UserService.InitFlowOperateControlUserDropDownList(this.drpProfessionalEngineer, this.CurrUser.LoginProjectId, BLL.CommonService.GetIsThisUnitId(), true); //专业工程师
                        BLL.UserService.InitFlowOperateControlUserDropDownList(this.drpConstructionManager, this.CurrUser.LoginProjectId, BLL.CommonService.GetIsThisUnitId(), true);  //施工经理
                        BLL.UserService.InitFlowOperateControlUserDropDownList(this.drpProjectManager, this.CurrUser.LoginProjectId, BLL.CommonService.GetIsThisUnitId(), true);       //项目经理
                    }
                    else if (State == "2")
                    {
                        this.next.Hidden              = true;
                        this.next1.Hidden             = true;
                        this.next3.Hidden             = true;
                        this.next4.Hidden             = true;
                        this.after.Hidden             = false;
                        this.txtWrongContent.Readonly = true;
                        this.txtRequirement.Readonly  = true;
                        this.txtLimitTime.Readonly    = true;
                        BLL.UserService.InitUserProjectIdUnitIdDropDownList(this.drpUnitHeadManId, this.CurrUser.LoginProjectId, this.drpUnitId.SelectedValue, true);//施工单位负责人
                    }
                    else if (State == "3")
                    {
                        this.next.Hidden        = true;
                        this.next1.Hidden       = true;
                        this.next2.Hidden       = true;
                        this.next4.Hidden       = true;
                        this.Itemcontent.Hidden = true;
                        this.btnSure.Hidden     = true;
                        BLL.UserService.InitUserProjectIdUnitIdDropDownList(this.drpSignPerson1, this.CurrUser.LoginProjectId, this.drpUnitId.SelectedValue, true);//复查人
                    }
                    else if (State == "4")
                    {
                        this.next.Hidden                = true;
                        this.next1.Hidden               = true;
                        this.next2.Hidden               = true;
                        this.next3.Hidden               = true;
                        this.end.Hidden                 = false;
                        this.after.Hidden               = false;
                        this.txtWrongContent.Readonly   = true;
                        this.txtRequirement.Readonly    = true;
                        this.txtLimitTime.Readonly      = true;
                        this.txtRectifyResults.Readonly = true;
                        Funs.FineUIPleaseSelect(drpIsRectify);
                    }
                    else if (State == "5")
                    {
                        this.next.Hidden        = true;
                        this.next1.Hidden       = true;
                        this.next2.Hidden       = true;
                        this.next3.Hidden       = true;
                        this.Itemcontent.Hidden = true;
                    }
                }
                else
                {
                    this.txtCompleteDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
                    State             = "0";
                    this.next1.Hidden = true;
                    this.next2.Hidden = true;
                    this.next3.Hidden = true;
                    this.next3.Hidden = true;
                    this.next4.Hidden = true;
                }

                BindGrid();
            }
        }