protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { return; } SPUser user = SPContext.Current.Web.CurrentUser; if (user != null) { Company company = com.GetCompanyInfo(BaseWebPart.GetCurrentUserLoginId()); userName.Value = BaseWebPart.GetCurrentUserLoginId(1); txtcompany.Value = company.Costomer; linkMan.Value = SPContext.Current.Web.CurrentUser.Name; phone.Value = company.phone; } QGCostcoSoapClient client = new QGCostcoSoapClient(); string preDate = DateTime.Now.ToString("yyyyMMddHHmmss");//Text1.Value; string errorMsg = ""; string errorCode = ""; string result = ""; try { result = client.getBookTime(preDate, out errorMsg, out errorCode); BaseComponent.Info("WebService Paras getBookTime:preDate " + preDate + ";errorMsg " + errorMsg + ";errorCode " + errorCode); if (errorCode == "0") { var appointment = com.GetAppointment(result); beginTime.Value = DateTime.ParseExact(appointment.STARTTIME, "yyyyMMddHHmmss", CultureInfo.InvariantCulture).ToString("yyyy-MM-dd HH:mm"); endTime.Value = DateTime.ParseExact(appointment.ENDTIME, "yyyyMMddHHmmss", CultureInfo.InvariantCulture).ToString("yyyy-MM-dd HH:mm"); DateTime time = DateTime.ParseExact(appointment.INSPECTIONDATE, "yyyyMMddHHmmss", CultureInfo.InvariantCulture); inspectionTime.Value = time.ToString("yyyy-MM-dd"); string[] weekdays = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" }; string week = weekdays[Convert.ToInt32(time.DayOfWeek)]; inspectionDay.Value = week; if (DateTime.Now < DateTime.ParseExact(appointment.STARTTIME, "yyyyMMddHHmmss", CultureInfo.InvariantCulture) || DateTime.Now > DateTime.ParseExact(appointment.ENDTIME, "yyyyMMddHHmmss", CultureInfo.InvariantCulture)) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('现在不是预约时间!');", true); } } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('今天不允许预约!');", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "connsuc", "layer.alert('加载预约时间失败啦!');", true); BaseComponent.Error(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { QGCostcoSoapClient client = new QGCostcoSoapClient(); string preDate = ""; string errorMsg = ""; string errorCode = ""; string result = ""; result = client.getBookTime(preDate, out errorMsg, out errorCode); }