Ejemplo n.º 1
0
        private bool DoAdd()
        {
            bool result = true;

            Model.car_repair_recordinfo model = new Model.car_repair_recordinfo();
            BLL.car_repair_recordbll    bll   = new BLL.car_repair_recordbll();
            model.Code           = txtCode.Text.Trim();
            model.Repare_Time    = txtRepare_Time.Text;
            model.Car            = new Model.carinfo();
            model.Car.Car_Number = ddlCar_Number.SelectedValue;
            string s = txtMileage.Text;

            model.Mileage               = Convert.ToInt32(s.Trim() == "" ? "0" : s);
            s                           = txtNext_Mileage.Text;
            model.Next_Mileage          = Convert.ToInt32(s.Trim() == "" ? "0" : s);
            model.Maintenance_Item      = new Model.car_maintenance_iteminfo();
            model.Maintenance_Item.Code = ddlMaintenance_Item.SelectedValue;
            model.Repair_Plant_Code     = ddlRepair_Plant.SelectedValue;
            model.Reason                = txtReason.Text;
            model.Driver                = new Model.car_driverinfo();
            model.Driver.Driver_Code    = ddlDriver_Code.SelectedValue;

            if (bll.Add(model) < 1)
            {
                result = false;
            }
            else
            {
                BLL.carbll carbl = new BLL.carbll();
                carbl.UpdateField(model.Car.Car_Number, " Status=2");
            }
            return(result);
        }
Ejemplo n.º 2
0
        private void BindCar_Number(string strwhere)
        {
            BLL.carbll carbll = new BLL.carbll();
            DataTable  cartb  = carbll.GetList(1000, strwhere, " id").Tables[0];

            BLL.car_use_recordbll carusebll = new BLL.car_use_recordbll();
            DataTable             carusedtb = carusebll.GetList(1000, " Status not in(5)", " id").Tables[0];

            this.ddlCar_Number.Items.Clear();
            this.ddlCar_Number.Items.Add(new ListItem("请选择车牌...", ""));
            foreach (DataRow dr in cartb.Rows)
            {
                bool   add        = true;
                string car_number = dr["Car_Number"].ToString();
                foreach (DataRow ro in carusedtb.Rows)
                {
                    string carnumber = ro["Car_Number"].ToString();
                    if (carnumber == car_number)
                    {
                        add = false; break;
                    }
                }
                if (!add)
                {
                    continue;
                }
                this.ddlCar_Number.Items.Add(new ListItem(car_number, car_number));
            }
        }
Ejemplo n.º 3
0
        private void ShowInfo(int _id)
        {
            BLL.carbll    bll   = new BLL.carbll();
            Model.carinfo model = bll.GetModel(_id);

            txtCar_Number.Text         = model.Car_Number;
            txtCar_Name.Text           = model.Car_Name;
            ddlDept_Pros.SelectedValue = model.Dept_Pros;
            ddlCar_Type.SelectedValue  = model.Car_Type.Type_Code;
            ddlDriver.SelectedValue    = model.Driver.Driver_Code;
            txtBuy_Date.Text           = model.Buy_Date.Replace(" 0:00:00", "");
            txtPrice.Text         = model.Price.ToString();
            txtMileage_First.Text = model.Mileage_First.ToString();
            //ddlStatus.SelectedValue = model.Status.ToString();
            txtOil_Consumption.Text = model.Oil_Consumption.ToString();
            txtEngine_Number.Text   = model.Engine_Number;
            txtFrame_Number.Text    = model.Frame_Number;
            txtWeight.Text          = model.Weight.ToString();
            txtSeat.Text            = model.Seat.ToString();
            txtcContent.Text        = model.cContent;
            string s1 = model.Image1;
            string s2 = model.Image2;

            Image1.ImageUrl = "~/" + s1.Replace("~/", "");
            Image2.ImageUrl = "~/" + s2.Replace("~/", "");
            //FileUpload1.FileName=model.Image1;
            //FileUpload2.FileName = model.Image2;
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string _action = DTRequest.GetQueryString("action");

            if (!string.IsNullOrEmpty(_action) && _action == DTEnums.ActionEnum.Edit.ToString())
            {
                this.action = DTEnums.ActionEnum.Edit.ToString();//修改类型
                this.id     = DTRequest.GetQueryInt("id");
                if (this.id == 0)
                {
                    JscriptMsg("传输参数不正确!", "back", "Error");
                    return;
                }
                if (!new BLL.car_repair_recordbll().Exists(this.id))
                {
                    JscriptMsg("信息不存在或已被删除!", "back", "Error");
                    return;
                }
            }
            if (!Page.IsPostBack)
            {
                txtCode.Text = DateTime.Now.ToString("yyyyMMddHHmmsss");
                BLL.carbll bll = new BLL.carbll();
                DataTable  tb  = bll.GetList(1000, " 1=1 and Status in(0,1)", " id").Tables[0];
                this.ddlCar_Number.Items.Clear();
                foreach (DataRow dr in tb.Rows)
                {
                    this.ddlCar_Number.Items.Add(new ListItem(dr["Car_Number"].ToString(), dr["Car_Number"].ToString()));
                }
                BLL.car_maintenance_itembll bll1 = new BLL.car_maintenance_itembll();
                DataTable tb1 = bll1.GetList(1000, " 1=1 ", " id").Tables[0];
                this.ddlMaintenance_Item.Items.Clear();
                foreach (DataRow dr in tb1.Rows)
                {
                    this.ddlMaintenance_Item.Items.Add(new ListItem(dr["Maintenance_Item_Name"].ToString(), dr["Code"].ToString()));
                }
                BLL.car_repair_plantbll bll2 = new BLL.car_repair_plantbll();
                DataTable tb2 = bll2.GetList(1000, " 1=1 ", " id").Tables[0];
                this.ddlRepair_Plant.Items.Clear();
                foreach (DataRow dr in tb2.Rows)
                {
                    this.ddlRepair_Plant.Items.Add(new ListItem(dr["Repair_Plant_Name"].ToString(), dr["Code"].ToString()));
                }
                BLL.car_driverbll bll3 = new BLL.car_driverbll();
                DataTable         tb3  = bll3.GetList(1000, " 1=1 ", " id").Tables[0];
                this.ddlDriver_Code.Items.Clear();
                foreach (DataRow dr in tb3.Rows)
                {
                    this.ddlDriver_Code.Items.Add(new ListItem(dr["Driver_Name"].ToString(), dr["Driver_Code"].ToString()));
                }
                if (action == DTEnums.ActionEnum.Edit.ToString()) //修改
                {
                    ShowInfo(this.id);
                }
            }
        }
Ejemplo n.º 5
0
        private bool DoEdit(int _id)
        {
            bool result = true;

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

            model.Car_Number         = txtCar_Number.Text.Trim();
            model.Car_Name           = txtCar_Name.Text;
            model.Dept_Pros          = ddlDept_Pros.SelectedValue;
            model.Car_Type.Type_Code = ddlCar_Type.SelectedValue;
            model.Driver.Driver_Code = ddlDriver.SelectedValue;
            model.Buy_Date           = txtBuy_Date.Text;
            model.Price         = Convert.ToDouble(txtPrice.Text.Trim() == "" ? "0" : txtPrice.Text.Trim());
            model.Mileage_First = Convert.ToInt32(txtMileage_First.Text.Trim() == "" ? "0" : txtMileage_First.Text.Trim());
            //model.Status = Convert.ToInt32(ddlStatus.SelectedValue);

            model.Oil_Consumption = float.Parse(txtOil_Consumption.Text.Trim() == "" ? "0" : txtOil_Consumption.Text.Trim());
            model.Engine_Number   = txtEngine_Number.Text;
            model.Frame_Number    = txtFrame_Number.Text;
            model.Weight          = float.Parse(txtWeight.Text.Trim() == "" ? "0" : txtWeight.Text.Trim());
            model.Seat            = Convert.ToInt32(txtSeat.Text.Trim() == "" ? "0" : txtSeat.Text.Trim());
            model.cContent        = txtcContent.Text;
            model.Image1          = Image1.ImageUrl;
            model.Image2          = Image2.ImageUrl;
            model.Image1          = model.Image1.Replace("~/", "");
            model.Image2          = model.Image2.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 s = files[i];
                    if (s.Contains("FileUpload1"))
                    {
                        model.Image1    = s;
                        Image1.ImageUrl = s;
                    }
                    else if (s.Contains("FileUpload2"))
                    {
                        model.Image2    = s;
                        Image2.ImageUrl = s;
                    }
                }
            }
            if (!bll.Update(model))
            {
                result = false;
            }
            return(result);
        }
Ejemplo n.º 6
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("users", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.carbll bll = new BLL.carbll();
     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("car_use_record_list.aspx", "group_id={0}&keywords={1}",
                                             this.group_id.ToString(), this.keywords), "Success");
 }
Ejemplo n.º 7
0
        private void AfterStatus()
        {
            string strid     = StringTrim(Request.Form["id"]);
            int    id        = Convert.ToInt32(strid);
            string strstatus = StringTrim(Request.Form["status"]);

            ChkAdminLevel("users", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            BLL.car_use_recordbll          bll    = new BLL.car_use_recordbll();
            DTcms.Model.car_use_recordinfo record = bll.GetModel(id);
            int iresult = 0;

            if (record.Status < 2)
            {
                string strupdate = "Status=2,Checker_Code='" + admin_info.user_name + "',Check_Time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:sss") + "'";
                iresult = bll.UpdateField(id, strupdate);
            }
            else if (record.Status == 2)
            {
                string strupdate = "Status=4,Update_Time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:sss") + "'";
                iresult = bll.UpdateField(id, strupdate);
                BLL.carbll cbll = new BLL.carbll();
                cbll.UpdateField(record.Car.Car_Number, "Status=1");
            }
            //else if (record.Status == 4)
            //{
            //    string strupdate = "Status=5,Update_Time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:sss") + "'";
            //    iresult = bll.UpdateField(id, strupdate);
            //    BLL.carbll cbll = new BLL.carbll();
            //    cbll.UpdateField(record.Car.Car_Number, "Status=0");
            //}
            if (iresult > 0)
            {
                //JscriptMsg("车辆状态修改成功!", Utils.CombUrlTxt("car_use_record_list.aspx", "group_id={0}&keywords={1}",
                //    this.group_id.ToString(), this.keywords), "Success");
            }
            ResultView view = new ResultView();

            view.putData("result", iresult);
            outResult(view);
        }
Ejemplo n.º 8
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page             = DTRequest.GetQueryInt("page", 1);
            this.txtKeywords.Text = this.keywords;
            BLL.carbll bll = new BLL.carbll();
            DataTable  tb  = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount).Tables[0];

            tb.Columns.Add("StatusText");
            for (int i = 0; i < tb.Rows.Count; i++)
            {
                int status = Convert.ToInt32(tb.Rows[i]["Status"] + "");
                tb.Rows[i]["StatusText"] = GetStatusText(status);
            }
            this.rptList.DataSource = tb;
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("car_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);
        }
Ejemplo n.º 9
0
        private bool DoEdit(int _id)
        {
            bool result = true;

            BLL.car_repair_recordbll    bll   = new BLL.car_repair_recordbll();
            Model.car_repair_recordinfo model = bll.GetModel(_id);
            string strcode = codelist.Value;
            string strcost = costlist.Value;

            string[] scodelist = null;
            string[] scostlist = null;
            if (strcode.Contains(","))
            {
                scodelist = strcode.Split(new string[] { "," }, StringSplitOptions.None);
            }
            else
            {
                scodelist = new string[] { strcode };
            }
            if (strcost.Contains(","))
            {
                scostlist = strcost.Split(new string[] { "," }, StringSplitOptions.None);
            }
            else
            {
                scostlist = new string[] { strcost };
            }
            for (int i = 0; i < scodelist.Length; i++)
            {
                car_repair_iteminfo iteminfo = new car_repair_iteminfo();
                iteminfo.Code = scodelist[i];
                try
                {
                    iteminfo.Cost = decimal.Parse(scostlist[i]);
                }
                catch { }
                model.Car_Repair_Items.Add(iteminfo);
            }

            model.Code = ddlCode.Text;
            model.Repare_Time_Finish = txtRepare_Time_Finish.Text;
            try
            {
                model.Cost = decimal.Parse(txtCost.Text);
            }
            catch { }
            model.Report = txtReport.Text;
            int iresult = bll.UpdateField(model.ID, " Repare_Time_Finish='" + model.Repare_Time_Finish + "',Report='" + model.Report + "',Cost=" + model.Cost + ",Status=1");

            if (iresult <= 0)
            {
                result = false;
            }
            else
            {
                if (bll.AddItem(model) <= 0)
                {
                    result = false;
                }
                else
                {
                    BLL.carbll carbl = new BLL.carbll();
                    carbl.UpdateField(model.Car.Car_Number, " Status=0");
                }
            }
            return(result);
        }