protected void Button_save_Click(object sender, EventArgs e) { if (this.TextBox_CaseID.Text.Trim().Equals("")) { ShowPageMsg("請先選擇資料!"); return; } bool suc = false; //string rowfilter = " CaseID = " + this.TextBox_CaseID.Text.Trim(); WarrantyNotify wn = new WarrantyNotify(); //DataSet ds = wn.Select(rowfilter, "", "WarrantyNotify"); DataTable dt = WarrantyNotifyDS.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; if (dr["CaseID"].Equals(int.Parse(this.TextBox_CaseID.Text))) { dr["NotifyConfirm"] = this.CheckBox_NotifyConfirm.Checked; dr["NotifyContact"] = this.TextBox_NotifyContact.Text.Trim(); if (!this.TextBox_PhoneConfirmDate.Text.Trim().Equals("")) { dr["PhoneConfirmDate"] = Convert.ToDateTime(this.TextBox_PhoneConfirmDate.Text.Trim()); } if (!this.TextBox_FaxConfirmDate.Text.Trim().Equals("")) { dr["FaxConfirmDate"] = Convert.ToDateTime(this.TextBox_FaxConfirmDate.Text.Trim()); } if (!this.TextBox_EmailConfirmDate.Text.Trim().Equals("")) { dr["EmailConfirmDate"] = Convert.ToDateTime(this.TextBox_EmailConfirmDate.Text.Trim()); } if (!this.TextBox_Deadline.Text.Trim().Equals("")) { dr["Deadline"] = Convert.ToDateTime(this.TextBox_Deadline.Text.Trim()); } //WarrantyNotifyDS.Tables[0].AcceptChanges(); DataSet DSChange = WarrantyNotifyDS.GetChanges(DataRowState.Modified); //DataSet DSChange = ds.GetChanges(DataRowState.Modified); suc = wn.Update(DSChange); break; } } if (suc) { loadGridViewData(); ShowPageMsg("儲存成功!"); } else { ShowPageMsg("儲存失敗!"); } }
public bool Equals(BaseComponent y) { if (y == null || ItemId != y.ItemId || ATAChapter != y.ATAChapter || PartNumber != y.PartNumber || Description != y.Description || SerialNumber != y.SerialNumber || MaintenanceControlProcess != y.MaintenanceControlProcess || Remarks != y.Remarks || Model != y.Model || Manufacturer != y.Manufacturer || LLPMark != y.LLPMark || LLPCategories != y.LLPCategories || LandingGear != y.LandingGear || AvionicsInventory != y.AvionicsInventory || ALTPartNumber != y.ALTPartNumber || MTOGW != y.MTOGW || HushKit != y.HushKit || Cost != y.Cost || CostOverhaul != y.CostOverhaul || CostServiceable != y.CostServiceable || Quantity != y.Quantity || ManHours != y.ManHours || !Warranty.IsEqual(y.Warranty) || !WarrantyNotify.IsEqual(y.WarrantyNotify) || Serviceable != y.Serviceable || GoodsClass != y.GoodsClass || ShelfLife != y.ShelfLife || MPDItem != y.MPDItem || //Suppliers != y.Suppliers || !LifeLimit.IsEqual(y.LifeLimit) || !LifeLimitNotify.IsEqual(y.LifeLimitNotify) || BaseComponentType != y.BaseComponentType) { return(false); } return(true); }
protected void Button_add_click(object sender, EventArgs e) { WarrantyNotify wn = new WarrantyNotify(); wn.DeviceID = DropDownList_DeviceID.SelectedValue; wn.FaultModel = this.DropDownList_FaultModel_add.Text; wn.FaultDescribe = this.TextBox_FaultDescribe_add.Text; wn.RepeatNotify = this.TextBox_RepeatNotify_add.Text; wn.WarrantyCompany = this.DropDownList_WarrantyCompany_add.SelectedItem.ToString(); wn.WarrantyContract = int.Parse(this.DropDownList_WarrantyContract_add.SelectedValue); wn.NotifyDate = Convert.ToDateTime(this.TextBox_NotifyDate_add.Text); wn.NotifyConfirm = false; if (this.DropDownList_ContractCombineNum.SelectedIndex > 0) { wn.ContractCombineNum = int.Parse(this.DropDownList_ContractCombineNum.SelectedItem.ToString()); } wn.Status = "維修中"; switch (this.DropDownList_RepairDateOption_add.SelectedIndex) { case 0: //修復日期選項 ShowPageMsg("請點選修復日期選項!"); return; //break; case 1: wn.RepairDateOption = 1; break; case 2: wn.RepairDateOption = 2; break; case 3: wn.RepairDateOption = 3; wn.RepairDeadline = Convert.ToDateTime(this.TextBox_RepairDeadline_add.Text); break; } try { wn.Add(); ShowPageMsg("新增保固單成功!"); UpdateServerData(); } catch (Exception ee) { ShowPageMsg("新增保固單失敗!"); } }
public bool Edit(WarrantyNotify warrantyNotify) { bool suc = false; //string rowFilter = " CaseID = " + warrantyNotify.CaseID; //DataSet ds = this.Select(rowFilter, "", warrantyNotify.tableName); //if (ds.Tables[0].Rows.Count == 1) //{ // DataRow dr = ds.Tables[0].Rows[0]; // if (this.FaultModel != null) // { // dr["FaultModel"] = this.FaultModel; // } // if (this.FaultDescribe != null) // { // dr["FaultDescribe"] = this.FaultDescribe; // } // if (this.RepeatNotify != null) // { // dr["RepeatNotify"] = this.RepeatNotify; // } // if (this.WarrantyCompany != null) // { // dr["WarrantyCompany"] = this.WarrantyCompany; // } // if (this.NotifyDate != null) // { // dr["NotifyDate"] = this.NotifyDate; // } // if (this.RepairDateOption != null) // { // dr["RepairDateOption"] = this.RepairDateOption; // } // if (this.RepairDeadline != null) // { // dr["RepairDeadline"] = this.RepairDeadline; // } // if (this.ContractCombineNum != null) // { // dr["ContractCombineNum"] = this.ContractCombineNum; // } // if (this.NotifyConfirm != null) // { // dr["NotifyConfirm"] = this.NotifyConfirm; // } // if (this.NotifyContact != null) // { // dr["NotifyContact"] = this.NotifyContact; // } // if (this.PhoneConfirmDate != null) // { // dr["PhoneConfirmDate"] = this.PhoneConfirmDate; // } // if (this.FaxConfirmDate != null) // { // dr["FaxConfirmDate"] = this.FaxConfirmDate; // } // if (this.EmailConfirmDate != null) // { // dr["EmailConfirmDate"] = this.EmailConfirmDate; // } // if (this.Deadline != null) // { // dr["Deadline"] = this.Deadline; // } // if (this.FaxReply != null) // { // dr["FaxReply"] = this.FaxReply; // } // if (this.ReplyContent != null) // { // dr["ReplyContent"] = this.ReplyContent; // } // if (this.RepairDate != null) // { // dr["RepairDate"] = this.RepairDate; // } // if (this.CheckID != null) // { // dr["CheckID"] = this.CheckID; // } // if (this.Checker != null) // { // dr["Checker"] = this.Checker; // } // if (this.CheckTIme != null) // { // dr["CheckTIme"] = this.CheckTIme; // } // if (this.CheckResult != null) // { // dr["CheckResult"] = this.CheckResult; // } // if (this.CheckDescribe != null) // { // dr["CheckDescribe"] = this.CheckDescribe; // } // if (this.Status != null) // { // dr["Status"] = this.Status; // } // if (this.Note != null) // { // dr["Note"] = this.Note; // } // if (this.ControlStatus != null) // { // dr["ControlStatus"] = this.ControlStatus; // } // DataSet DSChange = ds.GetChanges(DataRowState.Modified); // suc = this.Update(DSChange); //} return suc; }
protected void Button_add_click(object sender, EventArgs e) { //通報者名稱 string reportid = Session["UserID"].ToString(); if (TextBox_FaultDescribe_add.Text.Length == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "window.alert('請輸入故障描述!');", true); return; } if (hidden_Action.Value == "edit") { SQLDB _operator = new SQLDB(); DataSet ds_edit = _operator.Select("CaseID = '" + hidden_Caseid.Value + "'", "", "WarrantyNotify"); DataRow dr = ds_edit.Tables[0].Rows[0]; dr["FaultModel"] = this.DropDownList_FaultModel_add.Text; dr["FaultDescribe"] = this.TextBox_FaultDescribe_add.Text; dr["RepeatNotify"] = this.TextBox_RepeatNotify_add.Text; dr["WarrantyCompany"] = this.DropDownList_WarrantyCompany_add.SelectedItem.ToString(); dr["WarrantyContract"] = int.Parse(this.DropDownList_WarrantyContract_add.SelectedValue); dr["NotifyDate"] = Convert.ToDateTime(this.TextBox_NotifyDate_add.Text); if (this.DropDownList_ContractCombineNum.SelectedIndex > 0) { dr["ContractCombineNum"] = int.Parse(this.DropDownList_ContractCombineNum.SelectedItem.ToString()); } switch (this.DropDownList_RepairDateOption_add.SelectedIndex) { case 0: //修復日期選項 ScriptManager.RegisterStartupScript(this, this.GetType(), "", "window.alert('請點選修復日期選項!');", true); return; //break; case 1: dr["RepairDateOption"] = 1; break; case 2: dr["RepairDateOption"] = 2; break; case 3: dr["RepairDateOption"] = 3; dr["RepairDeadline"] = Convert.ToDateTime(this.TextBox_RepairDeadline_add.Text); break; } DataSet DSChange = ds_edit.GetChanges(DataRowState.Modified); if (_operator.Update(DSChange)) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "window.alert('修改成功');", true); UpdateServerData(); } } else { WarrantyNotify wn = new WarrantyNotify(); wn.DeviceID = this.TextBox_DeviceID_add.Text; wn.FaultModel = this.DropDownList_FaultModel_add.Text; wn.FaultDescribe = this.TextBox_FaultDescribe_add.Text; wn.RepeatNotify = this.TextBox_RepeatNotify_add.Text; wn.WarrantyCompany = this.DropDownList_WarrantyCompany_add.SelectedItem.ToString(); if (this.DropDownList_WarrantyContract_add.SelectedIndex > 0) { wn.WarrantyContract = int.Parse(this.DropDownList_WarrantyContract_add.SelectedValue); } wn.NotifyDate = Convert.ToDateTime(this.TextBox_NotifyDate_add.Text); wn.NotifyConfirm = false; if (this.DropDownList_ContractCombineNum.SelectedIndex > 0) { wn.ContractCombineNum = int.Parse(this.DropDownList_ContractCombineNum.SelectedItem.ToString()); } wn.Status = "維修中"; switch (this.DropDownList_RepairDateOption_add.SelectedIndex) { case 0: //修復日期選項 ScriptManager.RegisterStartupScript(this, this.GetType(), "", "window.alert('請點選修復日期選項!');", true); return; //break; case 1: wn.RepairDateOption = 1; break; case 2: wn.RepairDateOption = 2; break; case 3: wn.RepairDateOption = 3; wn.RepairDeadline = Convert.ToDateTime(this.TextBox_RepairDeadline_add.Text); break; } wn.Add(); ScriptManager.RegisterStartupScript(this, this.GetType(), "", "window.alert('新增成功');", true); UpdateServerData(); } if (chk_isSendMail.Checked) { try { //傳送通知email給廠商 string[] mailaddress = new string[1]; SQLDB _operateor = new SQLDB(); DataSet ds = new DataSet(); ds = _operateor.Select("CompanyID ='" + DropDownList_WarrantyCompany_add.SelectedValue + "'", "", "Company"); if (ds.Tables[0].Rows.Count > 0) { mailaddress[0] = ds.Tables[0].Rows[0]["Email"].ToString(); } Email notifyemail = new Email(); //通報內容 //string body = ""; string first_td = " <td width='150' align='center' style='background-color: #c4ffde;' > "; string second_td = " <td align='center' style='background-color: #ffff9d;' > "; StringBuilder body = new StringBuilder(); body.Append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"); body.Append("<HTML><HEAD><META http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"); body.Append("</HEAD><BODY>"); body.Append(" <table width='80%' border='1' align='center' cellpadding='0' cellspacing='0'>"); body.Append(" <tr> "); body.Append(" <td colspan='2' align='center' style='background-color: #ffcc33;'><h3> " + "新北市停車管理系統報修服務單" + "</h3> </td> "); body.Append(" </tr> "); body.Append(" <tr> "); body.Append(first_td + "設備編號" + " </td> "); body.Append(second_td + TextBox_DeviceID_add.Text + " </td> "); body.Append(" </td> "); body.Append(" </tr> "); body.Append(" <tr> "); body.Append(first_td + "通報者" + " </td> "); body.Append(second_td + reportid + " </td> "); body.Append(" </td> "); body.Append(" </tr> "); body.Append(" <tr> "); body.Append(first_td + "通報時間" + " </td> "); body.Append(second_td + TextBox_NotifyDate_add.Text + " </td> "); body.Append(" </td> "); body.Append(" </tr> "); body.Append(" <tr> "); body.Append(first_td + "指定修復日期" + " </td> "); body.Append(second_td + TextBox_RepairDeadline_add.Text + " </td> "); body.Append(" </td> "); body.Append(" </tr> "); body.Append(" <tr> "); body.Append(first_td + "損壞原因描述" + " </td> "); body.Append(second_td + TextBox_FaultDescribe_add.Text + " </td> "); body.Append(" </td> "); body.Append(" </tr> "); body.Append(" <tr> "); body.Append(" <td colspan='2' align='center' style='background-color: #cccc99;'> " + "本郵件由發信系統主動發出,請勿直接回覆,如有任何問題或意見,請撥電話至停管中心" + " </td> "); body.Append(" </tr> "); body.Append(" </table> "); body.Append("</BODY></HTML>"); if (notifyemail.toSend("新北市停車管理系統報修服務單", mailaddress, body.ToString())) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "window.alert('郵件寄送成功');", true); } } catch (Exception ee) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "window.alert('新增保固單失敗!');", true); } } }