/// <summary> /// Edit /// </summary> private void loadData() { Tb_line line = Tb_lineManager.getTb_lineById(Convert.ToInt32(Request.QueryString["id"])); this.txtlinename.Text = line.Line; this.txtlineremark.Text = line.LineRemark; this.txtautocode.Text = line.AutoCode; }
public string TourLine(int lineid) { if (lineid > 0) { return(Tb_lineManager.getTb_lineById(lineid).Line.ToString()); } else { return("线路出现错误"); } }
/// <summary> /// 选项变化操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlLine_SelectedIndexChanged(object sender, EventArgs e) { if (this.ddlLine.SelectedValue != "-1") { string remark = Tb_lineManager.getTb_lineById(Convert.ToInt32(ddlLine.SelectedValue)).LineRemark; this.txtRemark.Value = remark; } else { this.txtRemark.Value = ""; } }
/// <summary> /// 绑定线路 /// </summary> private void DdlToUserBindData() { DataTable data = Tb_lineManager.getList(""); ddlLine.DataTextField = "line"; ddlLine.DataValueField = "id"; ddlLine.DataSource = data; ddlLine.DataBind(); ListItem item = new ListItem("选择旅游路线", "-1"); this.ddlLine.Items.Insert(0, item); }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ibtnAdd_Click(object sender, ImageClickEventArgs e) { Tb_line line = Tb_lineManager.getTb_lineById(Convert.ToInt32(Request.QueryString["id"])); line.Line = this.txtlinename.Text; line.LineRemark = this.txtlineremark.Text; line.AutoCode = this.txtautocode.Text; int count = Tb_lineManager.updateTb_line(line); if (count > 0) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "edit", "<script>alert('保存成功');window.location='LineList.aspx'</script>", false); } }
/// <summary> /// 操作 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void cuslist_ItemCommand(object source, RepeaterCommandEventArgs e) { switch (e.CommandName) { case "Edit": Response.Redirect("EditLine.aspx?id=" + e.CommandArgument); break; case "Delete": Tb_lineManager.deleteTb_line(Convert.ToInt32(e.CommandArgument)); break; } DataLoad(); }
/// <summary> /// 绑定线路 /// </summary> private void BindLine() { ddlline.Items.Clear(); IList <Tb_line> linelist = Tb_lineManager.getTb_lineAll(); ddlline.Items.Add(new ListItem("选择线路", "-1")); //添加第一行默认 foreach (Tb_line line in linelist) { ListItem adItem = new ListItem(); adItem.Text = line.Line; adItem.Value = line.Line; ddlline.Items.Add(adItem); } }
/// <summary> /// 新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ibtnAdd_Click(object sender, ImageClickEventArgs e) { Tb_line lineModel = new Tb_line(); lineModel.Line = this.txtlinename.Text; lineModel.LineRemark = this.txtlineremark.Text; lineModel.AutoCode = this.txtautocode.Text; int count = Tb_lineManager.addTb_line(lineModel); if (count > 0) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "add", "<script>alert('添加成功');window.location='LineList.aspx'</script>", false); } }
/// <summary> /// 绑定线路 /// </summary> public void BindLine() { ddlLine.Items.Clear(); IList <Tb_line> typelist = Tb_lineManager.getTb_lineAll(); for (int i = 0; i < typelist.Count; i++) { ListItem list = new ListItem(typelist[i].Line.ToString(), typelist[i].Id.ToString()); ddlLine.Items.Add(list); } ListItem ltem = new ListItem("选择线路", "-1"); //添加第一行默认值 ddlLine.Items.Insert(0, ltem); //添加第一行默认值 }
/// <summary> /// 得到线路名称 /// </summary> /// <param name="line"></param> /// <returns></returns> private string GetLineName(string line) { int lineId = 0; int.TryParse(line, out lineId); Tb_line lineModel = Tb_lineManager.getTb_lineById(lineId); if (lineModel != null) { return(lineModel.Line); } else { return("线路未知"); } }
/// <summary> /// 返回名称,不包含流水号 /// 根据出团日期来编码订单序号 /// </summary> private string Numbers(string txtformat) { string result = ""; //返回的名称 DateTime outtime = new DateTime(); DateTime.TryParse(this.txtOutDate.Value, out outtime); int lineid = 0; int.TryParse(this.ddlLine.SelectedValue, out lineid); Tb_line line = Tb_lineManager.getTb_lineById(lineid); string linecode = ""; //线路自动编码标识符 if (line != null) { linecode = line.AutoCode; } LoginInfo login = Session["login"] as LoginInfo; string departcode = DepartmentInfoManager.getDepartmentInfoById(login.Departid).AutoCode; //部门自动编码标识符 if (txtformat.Contains("[YYYY]")) { txtformat = txtformat.Replace("[YYYY]", outtime.ToString("yyyy")); } if (txtformat.Contains("[YY]")) { txtformat = txtformat.Replace("[YY]", outtime.ToString("yy")); } if (txtformat.Contains("[MM]")) { txtformat = txtformat.Replace("[MM]", outtime.ToString("MM")); } if (txtformat.Contains("[DD]")) { txtformat = txtformat.Replace("[DD]", outtime.ToString("dd")); } if (txtformat.Contains("[XL]")) { txtformat = txtformat.Replace("[XL]", linecode); } if (txtformat.Contains("[BM]")) { txtformat = txtformat.Replace("[BM]", departcode); } result = txtformat; return(result); }