Esempio n. 1
0
    private void bindBaseData(string recordGID)
    {
        PartRepairRecord model = Service.GetPartRepairRecordbykey(new PartRepairRecord {
            RecordID = int.Parse(recordGID)
        });

        this.hidRecordID.Value   = recordGID;
        this.txtDescription.Text = model.Description;
        if (model.Part != null)
        {
            this.hidCurrentPartID.Value = model.Part.PartID.ToString();
            this.labPartCode.Text       = model.Part.PartCode;
            this.labPartName.Text       = model.Part.PartChineseName;
            if (model.Part.Plant != null)
            {
                this.labPlantName.Text = model.Part.Plant.PlantCode;
            }
            if (model.Part.Supplier != null)
            {
                this.labDUNS.Text = model.Part.Supplier.DUNS;
            }
        }
        if (model.Supplier != null)
        {
            this.hidSupplierID.Value = model.Supplier.SupplierID.ToString();
            hidSupplierDUNS.Value    = model.Supplier.DUNS;
            this.txtSupplier.Text    = model.Supplier.DUNS;
            this.txtFax.Text         = model.Supplier.Fax;
            this.txtTelephone.Text   = model.Supplier.PhoneNumber1;
        }
    }
Esempio n. 2
0
    private void bindGridView()
    {
        PartRepairRecord filter = new PartRepairRecord();

        if (ddlPlantID.SelectedValue.Length > 0)
        {
            filter.Part               = new Part();
            filter.Part.Plant         = new Plant();
            filter.Part.Plant.PlantID = int.Parse(ddlPlantID.SelectedValue);
        }
        if (this.txtPartCode.Text.Trim().Length > 0)
        {
            if (filter.Part == null)
            {
                filter.Part = new Part();
            }
            filter.Part.PartCode = this.txtPartCode.Text.Trim();
        }
        if (this.txtDUNS.Text.Trim().Length > 0)
        {
            if (filter.Part == null)
            {
                filter.Part = new Part();
            }
            filter.Part.PartCode      = this.txtPartCode.Text.Trim();
            filter.Part.Supplier      = new Supplier();
            filter.Part.Supplier.DUNS = this.txtDUNS.Text.Trim();
        }

        if (this.txtDUNS1.Text.Trim().Length > 0)
        {
            if (filter.Supplier == null)
            {
                filter.Supplier = new Supplier();
            }
            filter.Supplier.DUNS = this.txtDUNS1.Text.Trim();
        }
        if (this.txtSupplierName.Text.Trim().Length > 0)
        {
            if (filter.Supplier == null)
            {
                filter.Supplier = new Supplier();
            }
            filter.Supplier.SupplierName = this.txtSupplierName.Text.Trim();
        }


        int pageCount;
        int itemCount;
        List <PartRepairRecord> prrs = Service.QueryPartRepairRecordsByPage(filter, this.AspPager1.PageSize, this.AspPager1.SelectPageNumber, out pageCount, out itemCount);

        this.AspPager1.TotalPage   = pageCount;
        this.AspPager1.TotalRecord = itemCount;
        this.GridView1.DataSource  = prrs;
        this.GridView1.DataBind();
    }
Esempio n. 3
0
 public void DeletePartRepairRecord(PartRepairRecord model)
 {
     Channel.DeletePartRepairRecord(model);
 }
Esempio n. 4
0
 public PartRepairRecord AddPartRepairRecord(PartRepairRecord model)
 {
     return(Channel.AddPartRepairRecord(model));
 }
Esempio n. 5
0
 public void UpdatePartRepairRecord(PartRepairRecord model)
 {
     Channel.UpdatePartRepairRecord(model);
 }
Esempio n. 6
0
 public PartRepairRecord GetPartRepairRecordbykey(PartRepairRecord info)
 {
     return(Channel.GetPartRepairRecordbykey(info));
 }
Esempio n. 7
0
 public List <PartRepairRecord> QueryPartRepairRecordsByPage(PartRepairRecord info, int pageSize, int pageNumber, out int pageCount, out int itemCount)
 {
     return(Channel.QueryPartRepairRecordsByPage(info, pageSize, pageNumber, out pageCount, out itemCount));
 }
Esempio n. 8
0
 public List <PartRepairRecord> QueryPartRepairRecords(PartRepairRecord info)
 {
     return(Channel.QueryPartRepairRecords(info));
 }
Esempio n. 9
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.hidCurrentPartID.Value.Length > 0)
        {
            if (this.hidSupplierID.Value.Length > 0)
            {
                PartRepairRecord model = new PartRepairRecord();
                model.Part                  = new Part();
                model.Part.PartID           = int.Parse(this.hidCurrentPartID.Value);
                model.Supplier              = new Supplier();
                model.Supplier.SupplierID   = int.Parse(this.hidSupplierID.Value);
                model.Supplier.PhoneNumber1 = this.txtTelephone.Text.Trim();
                model.Supplier.Fax          = this.txtFax.Text.Trim();
                model.Description           = this.txtDescription.Text.Trim();
                model.DateModified          = DateTime.Now;

                if (hidRecordID.Value.Length > 0)
                {
                    model.RecordID = int.Parse(this.hidRecordID.Value);
                    PartRepairRecord filter = new PartRepairRecord
                    {
                        Part = new Part {
                            PartID = model.Part.PartID
                        }
                    };
                    List <PartRepairRecord> result = Service.QueryPartRepairRecords(filter);
                    if (result != null && result.Count > 0)
                    {
                        foreach (var item in result)
                        {
                            if (item.RecordID != model.RecordID)
                            {
                                ScriptManager.RegisterStartupScript(this, this.GetType(), "ScriptInvalidRecord", "alert('该零件的返修记录已存在!');", true);
                                return;
                            }
                        }
                    }
                    Service.UpdatePartRepairRecord(model);
                }
                else
                {
                    PartRepairRecord filter = new PartRepairRecord
                    {
                        Part = new Part {
                            PartID = model.Part.PartID
                        }
                    };
                    List <PartRepairRecord> result = Service.QueryPartRepairRecords(filter);
                    if (result != null && result.Count > 0)
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ScriptInvalidRecord", "alert('该零件的返修记录已存在!');", true);
                        return;
                    }
                    model = Service.AddPartRepairRecord(model);
                    this.hidRecordID.Value = model.RecordID.ToString();
                }
            }
            else
            {
                Response.Write("<script>alert('请选择返修供应商DUNS');</script>");
            }
        }
    }