コード例 #1
0
ファイル: electricity_add.aspx.cs プロジェクト: junprof/EC
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.dt_item   bll   = new BLL.dt_item();
            Model.dt_item model = bll.GetModel(_id);

            if (cbIsLock.Checked == true)
            {
                model.state = 2;
            }
            else
            {
                model.state = 1;
            }

            model.addr      = "";
            model.area_code = ddlArea.SelectedValue;
            model.name      = tbName.Text.Trim();
            //model.onenetnum = tbequipmentId.Text.Trim();
            model.position  = "";
            model.remarks   = "";
            model.trailerAI = double.Parse(tbtrailerAI.Text.Trim());
            // model.warningAI = double.Parse(tbwarningAI.Text.Trim());
            model.trailerBI = double.Parse(tbtrailerBI.Text.Trim());
            // model.warningBI = double.Parse(tbwarningBI.Text.Trim());
            model.trailerCI = double.Parse(tbtrailerCI.Text.Trim());
            //model.warningCI = double.Parse(tbwarningCI.Text.Trim());
            model.trailerLI = double.Parse(tbtrailerLI.Text.Trim());
            // model.warningLI = double.Parse(tbwarningLI.Text.Trim());
            model.trailerOneTemperature = double.Parse(tbtrailerOneTemperature.Text.Trim());
            // model.warningOneTemperature = double.Parse(tbwarningOneTemperature.Text.Trim());
            model.trailerTwoTemperature = double.Parse(tbtrailerTwoTemperature.Text.Trim());
            // model.warningTwoTemperature = double.Parse(tbwarningTwoTemperature.Text.Trim());
            model.trailerThreeTemperature = double.Parse(tbtrailerThreeTemperature.Text.Trim());
            //model.warningThreeTemperature = double.Parse(tbwarningThreeTemperature.Text.Trim());
            model.trailerFourTemperature = double.Parse(tbtrailerFourTemperature.Text.Trim());
            //model.warningFourTemperature = double.Parse(tbwarningFourTemperature.Text.Trim());
            model.trailerAV = double.Parse(tbTrailerU1.Text.Trim());
            model.trailerBV = double.Parse(tbTrailerU2.Text.Trim());
            model.trailerCV = double.Parse(tbTrailerU3.Text.Trim());
            model.position  = tbPosition.Text.Trim();
            model.user_id   = int.Parse(ddlUser.SelectedValue);


            if (bll.Update(model))
            {
                AddAdminLog("package_edit", "修改设备:" + model.id + "_" + model.name + "成功"); //记录日志
                result = true;
            }

            return(result);
        }
コード例 #2
0
        protected void btnOpen_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("electricity_list", DTEnums.ActionEnum.Edit.ToString()); //检查权限
            int    sucCount   = 0;
            int    errorCount = 0;
            string ids        = "";

            BLL.dt_item bll   = new BLL.dt_item();
            string      idstr = Request.Form["chkId"];

            string[] idlist = idstr.Split(',');
            if (idlist.Length > 0)
            {
                for (int i = 0; i < idlist.Length; i++)
                {
                    if (idlist[i].Trim() != null)
                    {
                        Model.dt_item model = bll.GetModel(int.Parse(idlist[i]));
                        if (model != null && model.state != 2)
                        {
                            Model.manager usermodel = GetAdminInfo();
                            if (usermodel.id != model.user_id && usermodel.role_type != 1)
                            {
                                errorCount += 1;
                            }
                            else
                            {
                                ids        += "," + idlist[i];
                                model.state = 2;
                                if (bll.Update(model))
                                {
                                    sucCount += 1;
                                }
                                else
                                {
                                    errorCount += 1;
                                }
                            }
                        }
                        else
                        {
                            errorCount += 1;
                        }
                    }
                }
            }
            AddAdminLog("item_open", "批量启用成功" + sucCount + "条,失败" + errorCount + "条," + ids); //记录日志


            JscriptMsg_Parent("批量启用成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("electricity_list.aspx", "state={0}&keywords={1}&page={2}&online={3}",
                                                                                                 ddlState.SelectedValue, this.keywords, this.page.ToString(), this.online.ToString()));
        }