using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using DSWeb.EntityDA; using System.Data; using DSWeb.Models; namespace DSWeb.SeanInfo { public partial class OpLetterTruckList : System.Web.UI.Page { public string strUserID = "";//登录用户GID public string strCompanyID = "";//公司GID public string strShowName = "";//用户显示名 public string strDeptName = "";//部门名称 DSWeb.EntityDA.Opsean opseaDA = new EntityDA.Opsean(); Models.OpseanEntity opseaEntity = new OpseanEntity(); protected void Page_Load(object sender, EventArgs e) { if (Session["USERID"] != null) { strUserID = Session["USERID"].ToString(); //this.hdUserID.Value = strUserID; } else { Server.Transfer("~/Error/FriendError.aspx"); return; } if (Session["SHOWNAME"] != null) { strShowName = Session["SHOWNAME"].ToString(); } if (Session["COMPANYID"] != null) { strCompanyID = Session["COMPANYID"].ToString(); } if (Session["DEPTNAME"] != null) { strDeptName = Session["DEPTNAME"].ToString(); } if (!this.IsPostBack) { //this.LoadRepeterInfo(); } } /// /// repeater加载派车单通知信息表 /// public void LoadRepeterInfo() { DataSet DS = opseaDA.GetNewCtnInfo(); PagedDataSource pds = new PagedDataSource(); pds.DataSource = DS.Tables[0].DefaultView; AspNetPager1.RecordCount=DS.Tables[0].Rows.Count; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; this.rep_letterTruck.DataSource = pds; this.rep_letterTruck.DataBind(); } /// /// 绑定承运车信息 /// //public void GetTeamTruck() //{ // DataTable table = opseaDA.GetTeamInfo(strCompanyID); // if (table != null) // { // this.drop_truck.DataSource = table.DefaultView; // this.drop_truck.DataTextField = "NewColumns"; // this.drop_truck.DataValueField = "SHORTNAME"; // this.drop_truck.DataBind(); // } // ListItem list = new ListItem("--承运车队--",""); // drop_truck.Items.Insert(0,list); //} /// /// 箱型dropdownlist /// //protected void getCTN() //{ // DataSet ctnds = opseaDA.GetAllCtn(); // if (ctnds != null) // { // drop_ctn.DataSource = ctnds.Tables[0].DefaultView; // drop_ctn.DataTextField = "CTN"; // drop_ctn.DataValueField = "CTN"; // drop_ctn.DataBind(); // } // ListItem list = new ListItem("--箱型--",""); // drop_ctn.Items.Insert(0,list); //} /// /// 船名 /// //protected void getVess() //{ // DataSet vessds = opseaDA.GetTCodeVessel(); // if (vessds !=null) // { // drop_vessName.DataSource = vessds.Tables[0].DefaultView; // drop_vessName.DataTextField = "NEWVESSL"; // drop_vessName.DataValueField = "CNAME"; // drop_vessName.DataBind(); // } // ListItem vesslist = new ListItem("--船名--",""); // drop_vessName.Items.Insert(0,vesslist); //} /// /// 航次 /// //protected void getVoyonum() //{ // DataSet voyods = opseaDA.GetOPSEAN(strCompanyID); // if (voyods != null) // { // drop_voyoNum.DataSource = voyods.Tables[0].DefaultView; // drop_voyoNum.DataTextField = ""; // drop_voyoNum.DataValueField = ""; // drop_voyoNum.DataBind(); // } // ListItem voyolist = new ListItem("--航次--",""); // drop_voyoNum.Items.Insert(0,voyolist); //} /// /// 根据条件查询信息 /// public void searchTruckInfo() { string teamtypeload = ""; string teamtypesend = ""; string startime = txt_startime.Value.Trim();//开始时间 string endtime = txt_endtime.Value.Trim();//结束时间 string moresearch = txtmoresearch.Text.Trim(); if (this.check_load.Checked) { teamtypeload = "0"; } if (this.check_send.Checked) { teamtypesend = "1"; } DataTable table = opseaDA.SearchTrucBy(startime, endtime, teamtypeload, teamtypesend,moresearch); PagedDataSource pds = new PagedDataSource(); pds.DataSource = table.DefaultView; AspNetPager1.RecordCount = table.Rows.Count; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; this.rep_letterTruck.DataSource = pds; this.rep_letterTruck.DataBind(); } /// /// 更改显示的派车类型 /// /// /// public string changeTruckType(object str) { switch(Convert.ToInt32(str)) { case 0: return "装货"; case 1: return "送货"; default: return "未知"; } } /// /// 更改显示是否完毕状态 /// /// /// public string changeIsTeamStatus(object str) { switch (Convert.ToInt32(str)) { case 0: return "生成单据"; case 1: return "完毕状态"; default: return "未操作"; } } /// /// 公共消息提示 /// /// public void CommonMessageBox(string strtext) { this.ClientScript.RegisterStartupScript(this.GetType(), "", ""); } protected void AspNetPager1_PageChanged(object sender, EventArgs e) { this.searchTruckInfo(); } protected void img_btnsearch_Click(object sender, ImageClickEventArgs e) { this.searchTruckInfo(); } protected void rep_letterTruck_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "isTeamStatus") { string leID = e.CommandArgument.ToString(); bool result = opseaDA.ChangeLetterStatus(leID); if (result) { //this.LoadRepeterInfo(); this.searchTruckInfo(); this.CommonMessageBox("操作成功"); } else { this.CommonMessageBox("操作失败,请重试"); } } } //转换时间显示格式 protected string ShowDateTime(object obt) { if (Convert.ToString(obt) != "") { DateTime time = Convert.ToDateTime(obt); if (time != null) { return time.ToString("yyyy-MM-dd").Trim(); } else { return "--"; } } else { return "--"; } } /// /// 删除多项数据 /// protected void img_DeleteInfo_Click(object sender, ImageClickEventArgs e) { string[] items = this.hid_savedeleteinfo.Value.Split(','); int iresult = opseaDA.DeleteLetterTruckbyID(items); if (iresult == 1) { //this.LoadRepeterInfo(); this.searchTruckInfo(); this.CommonMessageBox("删除成功"); } else { this.CommonMessageBox("删除失败,请重试"); } } } }