Ejemplo n.º 1
0
        private void ShowInfo(int _id)
        {
            BLL.accident_recordbll    bll   = new BLL.accident_recordbll();
            Model.accident_recordinfo model = bll.GetModel(_id);

            txtCode.Text = model.Code;
            ddlCar_Number.SelectedValue  = model.Car_Number;
            ddlDept_Code.SelectedValue   = model.Department.Dept_Code;
            ddlDriver_Code.SelectedValue = model.Driver.Driver_Code;
            txtAccident_Time.Text        = model.Accident_Time;
            ddlDuty.SelectedValue        = model.Duty;
            txtAddress.Text         = model.Address;
            txtInjured.Text         = model.Injured;
            txtLostCost.Text        = model.LostCost.ToString();
            txtFine.Text            = model.Fine.ToString();
            txtPayCost.Text         = model.PayCost.ToString();
            txtNoPayCost.Text       = model.NoPayCost.ToString();
            txtAccident_Reason.Text = model.Accident_Reason;
            string s1 = model.Image1;
            string s2 = model.Image2;
            string s3 = model.Image3;
            string s4 = model.Image4;

            Image1.ImageUrl = "~/" + s1.Replace("~/", "");
            Image2.ImageUrl = "~/" + s2.Replace("~/", "");
            Image3.ImageUrl = "~/" + s3.Replace("~/", "");
            Image4.ImageUrl = "~/" + s4.Replace("~/", "");
        }
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page             = DTRequest.GetQueryInt("page", 1);
            this.txtKeywords.Text = this.keywords;
            BLL.accident_recordbll bll = new BLL.accident_recordbll();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("accident_record_list.aspx", "group_id={0}&keywords={1}&page={2}",
                                              this.group_id.ToString(), this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("users", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.accident_recordbll bll = new BLL.accident_recordbll();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             bll.Delete(id);
         }
     }
     JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("accident_record_list.aspx", "group_id={0}&keywords={1}",
                                             this.group_id.ToString(), this.keywords), "Success");
 }
Ejemplo n.º 4
0
        private bool DoEdit(int _id)
        {
            bool result = true;

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

            model.Code                 = txtCode.Text.Trim();
            model.Car_Number           = ddlCar_Number.SelectedValue;
            model.Department.Dept_Code = ddlDept_Code.SelectedValue;
            model.Driver.Driver_Code   = ddlDriver_Code.SelectedValue;
            model.Accident_Time        = txtAccident_Time.Text;
            model.Duty                 = ddlDuty.SelectedValue;
            model.Address              = txtAddress.Text;
            model.Injured              = txtInjured.Text;
            string s = txtLostCost.Text;

            model.LostCost = decimal.Parse(s == "" ? "0" : s);
            s                     = txtFine.Text;
            model.Fine            = decimal.Parse(s == "" ? "0" : s);
            s                     = txtPayCost.Text;
            model.PayCost         = decimal.Parse(s == "" ? "0" : s);
            s                     = txtNoPayCost.Text;
            model.NoPayCost       = decimal.Parse(s == "" ? "0" : s);
            model.Accident_Reason = txtAccident_Reason.Text;
            model.Image1          = Image1.ImageUrl;
            model.Image2          = Image2.ImageUrl;
            model.Image3          = Image3.ImageUrl;
            model.Image4          = Image4.ImageUrl;
            model.Image1          = model.Image1.Replace("~/", "");
            model.Image2          = model.Image2.Replace("~/", "");
            model.Image3          = model.Image3.Replace("~/", "");
            model.Image4          = model.Image4.Replace("~/", "");
            string        savepath = HttpRuntime.AppDomainAppPath + "upload";
            List <string> files    = new List <string>();
            bool          b        = ControlCenter.saveFile(savepath, ref files, Request.Files, admin_info.user_name);

            if (b)
            {
                for (int i = 0; i < files.Count; i++)
                {
                    string simg = files[i];
                    if (simg.Contains("FileUpload1"))
                    {
                        model.Image1    = simg;
                        Image1.ImageUrl = simg;
                    }
                    else if (simg.Contains("FileUpload2"))
                    {
                        model.Image2    = simg;
                        Image2.ImageUrl = simg;
                    }
                    else if (simg.Contains("FileUpload3"))
                    {
                        model.Image3    = simg;
                        Image3.ImageUrl = simg;
                    }
                    else if (simg.Contains("FileUpload4"))
                    {
                        model.Image4    = simg;
                        Image4.ImageUrl = simg;
                    }
                }
            }

            if (!bll.Update(model))
            {
                result = false;
            }
            return(result);
        }