protected void vSave_Click(object sender, EventArgs e) { try { OrderItemManager.Save(_OrderItem); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Message", "alert('儲存成功');window.parent.$.fancybox.close();", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Exception", "alert('" + ex.Message + "');", true); } }
protected void vSave_Click(object sender, EventArgs e) { try { List <string> Errors = new List <string>(); //身分證字號 string Id = this.vId.Text.Trim(); if (UserManager.IdCheck(Id) == false) { Errors.Add("身分證字號格式不正確"); } else if (_Argument["Mode"] == "Add" && UserManager.GetUser(Id) != null) { Errors.Add("此身分證字號已經被使用"); } //姓名 string Name = this.vName.Text.Trim(); if (string.IsNullOrWhiteSpace(Name) == true) { Errors.Add("姓名不可空白"); } //聯絡電話 string Phone = this.vPhone.Text.Trim(); if (string.IsNullOrWhiteSpace(Phone) == true) { Errors.Add("連絡電話不可空白"); } if (Errors.Count > 0) { throw new Exception(string.Join("\\r\\n", Errors.ToArray())); } _OrderItem.MemberAccount = Id; _OrderItem.MemberName = Name; _OrderItem.MemberPhone = Phone; OrderItemManager.Save(_OrderItem); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Message", "alert('儲存成功');window.parent.$.fancybox.close();", true); } catch (Exception ex) { LeftHand.Gadget.Dialog.Alert(ex.Message); } }
//訂單狀態修改 protected void vStateType_SelectedIndexChanged(object sender, EventArgs e) { try { //取得選單上綁著的 OrderItemId RadioButtonList RadioButtonList = (RadioButtonList)sender; decimal OrderItemId = decimal.Parse(RadioButtonList.Attributes["OrderItemId"]); OrderItem OrderItem = _MonthOrderItems.FirstOrDefault(o => o.Id == OrderItemId); OrderItem.State = (StateType)Enum.Parse(typeof(StateType), RadioButtonList.SelectedValue); OrderItemManager.Save(OrderItem); } catch (Exception ex) { LeftHand.Gadget.Dialog.Alert(ex.Message); } }
protected void vSendButton_Click(object sender, EventArgs e) { try { List <string> Errors = new List <string>(); #region QuestionResult; string QuestionResult = ""; int QuestionnaireItemIndex = 0; foreach (RepeaterItem RepeaterItem in this.vQuestionnaire_List.Items) { QuestionnaireItem QuestionnaireItem = _QuestionnaireItems[QuestionnaireItemIndex]; switch (QuestionnaireItem.OptionType) { case OptionType.單選: RadioButtonList vRadioButtonList = (RadioButtonList)RepeaterItem.FindControl("vRadioButtonList"); if (string.IsNullOrWhiteSpace(vRadioButtonList.SelectedValue)) { Errors.Add(string.Format("請填寫第{0}題的答案", QuestionnaireItem.Sort)); } QuestionResult += string.Format("{0}:{1}<br />", QuestionnaireItem.ShortTitle, vRadioButtonList.SelectedValue); break; case OptionType.多選: CheckBoxList vCheckBoxList = (CheckBoxList)RepeaterItem.FindControl("vCheckBoxList"); if (string.IsNullOrWhiteSpace(vCheckBoxList.SelectedValue)) { Errors.Add(string.Format("請填寫第{0}題的答案", QuestionnaireItem.Sort)); } QuestionResult += string.Format("{0}:{1}<br />", QuestionnaireItem.ShortTitle, vCheckBoxList.SelectedValue); break; case OptionType.單行文字方塊: List <string> OptionResult = new List <string>(); Repeater vTextBoxList = (Repeater)RepeaterItem.FindControl("vTextBoxList"); foreach (RepeaterItem TextBoxItem in vTextBoxList.Items) { string Option = ((TextBox)TextBoxItem.FindControl("vResult")).Text.Trim().Replace(" ", ""); if (string.IsNullOrWhiteSpace(Option)) { Errors.Add(string.Format("請填寫第{0}題第{1}項的答案", QuestionnaireItem.Sort, TextBoxItem.ItemIndex + 1)); } OptionResult.Add(Option); } QuestionResult += string.Format("{0}:{1}<br />", QuestionnaireItem.ShortTitle, string.Join(",", OptionResult)); break; } QuestionnaireItemIndex += 1; } #endregion #region vSystemRemark; string SystemRemark = this.vSystemRemark.Value.Trim(); #endregion if (Errors.Count > 0) { throw new Exception(string.Join("\\r\\n", Errors)); } _CurrentOrderItem.QuestionResult = QuestionResult; _CurrentOrderItem.SyatemRemark = SystemRemark; OrderItemManager.Save(_CurrentOrderItem); ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "Message", "top.location.replace('Finish_Form.aspx');", true); } catch (Exception ex) { LeftHand.Gadget.Dialog.Alert(ex.Message); } }