/// <summary>
 /// 更新LineStation纪录 
 /// </summary>
 /// <returns></returns>
 public void UpdateLineStation(LineStation lineStation)
 {
     lineRepository.UpdateLineStation(lineStation);
 }
Exemple #2
0
    protected void btnSave_ServerClick(Object sender, EventArgs e)
    {
        pmtMessage1 = this.GetLocalResourceObject(Pre + "_pmtMessage1").ToString();
        pmtMessage3 = this.GetLocalResourceObject(Pre + "_pmtMessage3").ToString();

        LineStation item = new LineStation();

        string id = this.ID.Value.Trim();
        string oldStation = this.oldStation.Value.Trim();

        string line = this.CmbMaintainLine.InnerDropDownList.SelectedValue.Trim();
        string station = this.cmbStation.InnerDropDownList.SelectedValue.Trim();
        if(line.Equals("") || station.Equals(""))
        {
            alertErrorMessage(pmtMessage3);
            ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DealHideWait();ShowRowEditInfo(null);", true);
            return;
        }

        string status = this.DropDownList_MyStatus.SelectedIndex.ToString();

        if (station != "" && station != oldStation && pdLineStation.IFLineStationIsExists(line, station))
        {
            alertErrorMessage(pmtMessage1);
            ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "ShowRowEditInfo(null);DealHideWait();", true);
            return;
        }
        try
        {
            item.Line = line;
            item.Station = station;
            item.Status = status;
            item.Editor = this.HiddenUserName.Value;
            item.Udt = DateTime.Now;
            if (station != "" && station != oldStation)
            {
                item.Cdt = DateTime.Now;
                id=pdLineStation.AddLineStation(item).ToString();
            }
            else if (station != "" && station == oldStation)
            {
                item.ID = int.Parse(id);
                pdLineStation.UpdateLineStation(item);
            }
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
        }

        ShowLineStationList();
        id = replaceSpecialChart(id);

        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "Update", "AddUpdateComplete('" + id + "');DealHideWait();", true);

    }
 /// <summary>
 /// 添加LineStation,返回新纪录的ID 
 /// </summary>
 /// <returns></returns>
 public int AddLineStation(LineStation lineStation)
 {
     lineRepository.AddLineStation(lineStation);
     return lineStation.ID;
 }