public static Control GetFieldControl(this SPFieldCalculated calcField) { Control control = null; switch (calcField.OutputType) { case SPFieldType.Number: case SPFieldType.Currency: control = new TextBox() { CssClass = "ms-long" }; break; case SPFieldType.DateTime: DateTimeControl dtcValueDate = new DateTimeControl(); dtcValueDate.DateOnly = (calcField.DateFormat == SPDateTimeFieldFormatType.DateOnly); control = dtcValueDate; break; case SPFieldType.Boolean: control = new CheckBox(); break; default: control = new TextBox() { CssClass = "ms-long" }; break; } return control; }
private void InitializeCustomControls() { InitToolBar(); dtcVerifyTime = GetControltByMaster("dtcVerifyTime") as DateTimeControl; txtRemark = GetControltByMaster("txtRemark") as TextBox; btnOK = (Button)GetControltByMaster("btnOK"); btnOK.Click += new EventHandler(btnOK_Click); //初始化spgvMaterial this.spgvMaterial = new SPGridView(); this.spgvMaterial.AutoGenerateColumns = false; this.spgvMaterial.Attributes.Add("style", "word-break:keep-all;word-wrap:normal"); BoundField bfColumn; foreach (var kvp in ShowTlist) { bfColumn = new BoundField(); bfColumn.HeaderText = kvp.Split(':')[0]; bfColumn.DataField = kvp.Split(':')[1]; this.spgvMaterial.Columns.Add(bfColumn); } }
public static Control GetFieldControl(this SPFieldCalculated calcField) { Control control = null; switch (calcField.OutputType) { case SPFieldType.Number: case SPFieldType.Currency: control = new TextBox() { CssClass = "ms-long" }; break; case SPFieldType.DateTime: DateTimeControl dtcValueDate = new DateTimeControl(); dtcValueDate.DateOnly = (calcField.DateFormat == SPDateTimeFieldFormatType.DateOnly); control = dtcValueDate; break; case SPFieldType.Boolean: control = new CheckBox(); break; default: control = new TextBox() { CssClass = "ms-long" }; break; } return(control); }
private void CreateTable() { //table Cells Controls TextBox txt1 = new TextBox(); txt1.Height = 19; TextBox txt2 = new TextBox(); txt2.Height = 19; TextBox txt3 = new TextBox(); txt3.Height = 19; DateTimeControl dt1 = new DateTimeControl(); dt1.DateOnly = true; DateTimeControl dt2 = new DateTimeControl(); dt2.DateOnly = true; Button btnAdd = new Button(); btnAdd.Text = "Create New Row"; btnAdd.Click += new EventHandler(btnAdd_Click); //Declaration one Row and Five Cells(with controls) Table myTbl = new Table(); myTbl.ID = "tblUsers"; TableRow tRow = new TableRow(); TableCell tCellOne = new TableCell(); tCellOne.Controls.Add(txt1); tRow.Cells.Add(tCellOne); TableCell tCellTwo = new TableCell(); tCellTwo.Controls.Add(dt1); tRow.Cells.Add(tCellTwo); TableCell tCellThree = new TableCell(); tCellThree.Controls.Add(dt2); tRow.Cells.Add(tCellThree); TableCell tCellFour = new TableCell(); tCellFour.Controls.Add(txt2); tRow.Cells.Add(tCellFour); TableCell tCellFive = new TableCell(); tCellFive.Controls.Add(txt3); tRow.Cells.Add(tCellFive); myTbl.Rows.Add(tRow); this.Controls.Add(myTbl); this.Controls.Add(btnAdd); }
public void validateDateLine2(DateTimeControl date, TextBox text) { if (opCao14.Checked) { text.Text = date.SelectedDate.AddDays(24).ToShortDateString(); } if (opCao12.Checked || opCao21.Checked) { text.Text = date.SelectedDate.AddDays(19).ToShortDateString(); } if (opCao5.Checked || opCao17.Checked || opCao19.Checked || opCao20.Checked) { text.Text = date.SelectedDate.AddDays(14).ToShortDateString(); } if (opCao4.Checked || opCao7.Checked || opCao18.Checked) { text.Text = date.SelectedDate.AddDays(9).ToShortDateString(); } if (opCao3.Checked || opCao6.Checked || opCao8.Checked || opCao10.Checked || opCao11.Checked || opCao13.Checked || opCao16.Checked) { text.Text = date.SelectedDate.AddDays(4).ToShortDateString(); } }
private void InitializeCustomControl() { InitBar(); this.ddlProprietor = GetControltByMaster("ddlProprietor") as DropDownList; this.ddlProprietor.SelectedIndexChanged += new EventHandler(ddlProprietor_SelectedIndexChanged); this.ddlConstructor = GetControltByMaster("ddlConstructor") as DropDownList; this.ddlProject = GetControltByMaster("ddlProject") as DropDownList; this.ddlProject.SelectedIndexChanged += new EventHandler(ddlProject_SelectedIndexChanged); this.ddlProjectStage = GetControltByMaster("ddlProjectStage") as DropDownList; this.txtProperty = GetControltByMaster("txtProperty") as TextBox; this.btnSave = GetControltByMaster("btnSave") as Button; this.btnSave.Click += new EventHandler(btnSave_Click); this.txtNoticeCode = GetControltByMaster("txtNoticeCode") as TextBox; this.txtRemark = GetControltByMaster("txtRemark") as TextBox; this.dtcCreateTime = GetControltByMaster("dtcCreateTime") as DateTimeControl; vldNoticeCode = GetControltByMaster("vldNoticeCode") as CustomValidator; vldNoticeCode.ClientValidationFunction = "vldDDL"; vldNoticeCode.ServerValidate += new ServerValidateEventHandler(vldNoticeCode_ServerValidate); (GetControltByMaster("ltrJS") as Literal).Text = JSDialogAid.GetVerifyDDLJSForVld("--请选择--", "您填入的信息不完整,请核实后重新提交!"); }
public void UCITestCreateOpportunity_ClearHeaderDate() { var client = new WebClient(TestSettings.Options); using (var xrmApp = new XrmApp(client)) { xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecretKey); xrmApp.Navigation.OpenApp(UCIAppName.Sales); xrmApp.Navigation.OpenSubArea("Sales", "Opportunities"); xrmApp.CommandBar.ClickCommand("New"); xrmApp.ThinkTime(5000); xrmApp.Entity.SetValue("name", "Opportunity " + TestSettings.GetRandomString(5, 10)); DateTime expectedDate = DateTime.Today.AddDays(10); xrmApp.Entity.SetHeaderValue("estimatedclosedate", expectedDate); var control = new DateTimeControl("estimatedclosedate"); DateTime?date = xrmApp.Entity.GetHeaderValue(control); Assert.AreEqual(expectedDate, date); xrmApp.Entity.ClearHeaderValue(control); date = xrmApp.Entity.GetHeaderValue(control); Assert.AreEqual(null, date); } }
private void InitializeCustomControls() { InitToolBar(); chbReadWork = GetControltByMaster("chbReadWork") as CheckBox; btnSave = (Button)GetControltByMaster("btnSave"); btnSave.Click += new EventHandler(btnSave_Click); vldCode = (CustomValidator)GetControltByMaster("vldCode"); vldCode.ServerValidate += new ServerValidateEventHandler(vldCode_ServerValidate); txtCode = GetControltByMaster("txtCode") as TextBox; txtRemark = GetControltByMaster("txtRemark") as TextBox; dtcCreateTime = GetControltByMaster("dtcCreateTime") as DateTimeControl; switch (_type) { case "维修保养表": ((Label)GetControltByMaster("lblCodeName")).Text = "维修保养计划表编号"; break; case "回收检验表": ((Label)GetControltByMaster("lblCodeName")).Text = "回收检验传递表编号"; chbReadWork.Visible = true; break; } }
protected void setPanelInconsistencies(string id, DateTimeControl periodoInicio, string paInicio, string periodoFim, Button btnCheck) { int saldoDiasPA = new IntegranteQueryPASTotalgeral().saldoDias(id, paInicio); labelSaldoDiasPA.Text = saldoDiasPA.ToString(); var culture = new System.Globalization.CultureInfo("pt-BR"); labelInicioFerias.Text = culture.DateTimeFormat.GetDayName(periodoInicio.SelectedDate.DayOfWeek); labelMesFerias.Text = culture.DateTimeFormat.GetMonthName(periodoInicio.SelectedDate.Month); labelDiasAntecedencia.Text = (periodoInicio.SelectedDate - DateTime.Now).Days.ToString(); labelDataInicio.Text = periodoInicio.SelectedDate.ToShortDateString(); labelLimiteGozo.Text = DateTime.Parse(paInicio).AddYears(2).ToShortDateString(); if (btnCheck.ID.Equals("checarBTN1")) { labelPeriodo.Text = DateTime.Parse(paFim.Text).AddDays(1).ToShortDateString(); } else { labelPeriodo.Text = DateTime.Parse(periodoFim).AddDays(1).ToShortDateString(); } if (btnCheck.ID.Equals("checarBTN1")) { labelTitlePeriodo.Text = "PERÍODO 1"; } if (btnCheck.ID.Equals("checarBTN2")) { labelTitlePeriodo.Text = "PERÍODO 2"; } if (btnCheck.ID.Equals("checarBTN3")) { labelTitlePeriodo.Text = "PERÍODO 3"; } }
private void InitControl() { this.txtStorageinNum = (TextBox)GetControltByMaster("txtStorageinNum"); this.txtMaterialCode = (TextBox)GetControltByMaster("txtMaterialCode"); this.txtMaterialMod = (TextBox)GetControltByMaster("txtMaterialMod"); this.txtID = (TextBox)GetControltByMaster("txtID"); this.txtFinanceCode = (TextBox)GetControltByMaster("txtFinanceCode"); this.txtCommitMaterial = (TextBox)GetControltByMaster("txtCommitMaterial"); this.txtcommitID = (TextBox)GetControltByMaster("txtcommitID"); this.txtGTJ = (TextBox)GetControltByMaster("txtGTJ"); this.txtMetre = (TextBox)GetControltByMaster("txtMetre"); this.txtTon = (TextBox)GetControltByMaster("txtTon"); this.ddlproject = (DropDownList)GetControltByMaster("ddlproject"); this.DateTimeStorageIn = (DateTimeControl)GetControltByMaster("DateTimeStorageIn"); this.ddlbatch = (DropDownList)GetControltByMaster("ddlbatch"); this.txtRemark = (TextBox)GetControltByMaster("txtRemark"); this.btnSave = (Button)GetControltByMaster("btnSave"); this.btnQuit = (Button)GetControltByMaster("btnQuit"); this.btnSave.Click += new EventHandler(btnSave_Click); this.btnQuit.CausesValidation = false; this.btnQuit.Click += new EventHandler(btnQuit_Click); }
protected override Control CreateControl() { DateTimeControl c = new DateTimeControl(); c.IsRequired = this.IsRequired; c.ShowType = DateTimeControl.ShowTypes.Date; return(c); }
protected void btnAssign_Click(object sender, EventArgs e) { var closeLink = (Control)sender; GridViewRow row = (GridViewRow)closeLink.NamingContainer; int index = row.RowIndex; string IssueNo = row.Cells[0].Text; // here we are DateTimeControl FirstrowDate = (DateTimeControl)gvIssueAdminView.Rows[index].FindControl("txtIssueDueDate"); PeopleEditor ppAuthor = (PeopleEditor)gvIssueAdminView.Rows[index].FindControl("txtAssignTo"); TextBox Comments = (TextBox)gvIssueAdminView.Rows[index].FindControl("txtcomments"); if (ppAuthor.Entities.Count != 0) { SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite Osite = new SPSite(SPContext.Current.Site.ID)) { using (SPWeb Oweb = Osite.OpenWeb()) { SPList Olist = Oweb.Lists[Utilities.IssueTrackerListName]; var Ospquery = new SPQuery(); Ospquery.Query = @"<Where><Eq><FieldRef Name='Issue_x0020_No' /><Value Type='Text'>" + IssueNo + "</Value></Eq></Where>"; SPListItemCollection Olistcollection = Olist.GetItems(Ospquery); foreach (SPListItem item in Olistcollection) { if (!FirstrowDate.IsDateEmpty) { item["Issue Deadline"] = FirstrowDate.SelectedDate.ToShortDateString(); } item["Assign To"] = Utilities.UserValueCollection(Oweb, ppAuthor.CommaSeparatedAccounts.ToString() + ";"); item["Comments"] = Comments.Text; item["Issue Status"] = "Assigned"; Oweb.AllowUnsafeUpdates = true; item.Update(); Oweb.AllowUnsafeUpdates = false; SPUser user = SPContext.Current.Web.EnsureUser(ppAuthor.CommaSeparatedAccounts.ToString()); Utilities.SendNotification(Oweb, user.Email + ";", "New Leave Application Issue has been assigned.", IssueNo, "Yes"); DataBind(); } } } }); } else { lblerror.Text = "Please Enter Assigne To"; } foreach (GridViewRow currentrow in gvIssueAdminView.Rows) { PeopleEditor ppAuthorNew = (PeopleEditor)currentrow.FindControl("txtAssignTo"); ppAuthorNew.Accounts.Clear(); ppAuthorNew.Entities.Clear(); ppAuthorNew.ResolvedEntities.Clear(); } }
void dtc_DataBinding(object sender, EventArgs e) { DateTimeControl dtc = (DateTimeControl)sender; SPGridViewRow fc = (SPGridViewRow)dtc.NamingContainer; if (!string.IsNullOrEmpty(strBindColumn)) { dtc.SelectedDate = Convert.ToDateTime(DataBinder.Eval(fc.DataItem, strBindColumn)); } }
public void clearAndDisableLineForm(TextBox txtBox, Label label, DateTimeControl date, Button btn) { label.Visible = false; date.Visible = false; date.ClearSelection(); txtBox.Visible = false; txtBox.Text = ""; btn.Visible = false; enviarBTN.Visible = true; }
private void InitControl() { this.txtBillCode = (TextBox)GetControltByMaster("txtBillCode"); this.txtRemark = (TextBox)GetControltByMaster("txtRemark"); this.DateTimeStorageIn = (DateTimeControl)GetControltByMaster("DateTimeStorageIn"); this.btnSave = (Button)GetControltByMaster("btnSave"); this.btnQuit = (Button)GetControltByMaster("btnQuit"); this.btnSave.Click += new EventHandler(btnSave_Click); this.btnQuit.CausesValidation = false; this.btnQuit.Click += new EventHandler(btnQuit_Click); }
protected override Control CreateControl() { _control = new DateTimeControl { ID = ("c" + _field.Name), ToolTip = _field.Description }; FormControlDate.InitializeDatePicker(_control); return(_control); }
/// <summary> /// Sets the time picker. /// </summary> /// <param name="control">The control to be setup.</param> /// <param name="date">The date.</param> internal static void SetTimePicker(this DateTimeControl control, DateTime?date) { if (date.HasValue) { control.SelectedDate = date.Value; } else { control.IsValid = false; control.SelectedDate = CAS.SharePoint.Extensions.SPMinimum; } }
public void InstantiateIn(Control ctlContainer) { switch (dcrtColumnType) { case DataControlRowType.DataRow: //TemplateContent DateTimeControl dtc = new DateTimeControl(); dtc.ID = strBindColumn; dtc.DateOnly = true; dtc.DataBinding += new EventHandler(dtc_DataBinding); ctlContainer.Controls.Add(dtc); break; } }
void StandartHesap(string onEk) { TextBox txt = new TextBox(); txt.ID = "rgsAdi"; txt.CssClass = "form-control"; txt.MaxLength = 18; CustomizeControl1.AddControl(onEk + "Adı", txt); txt = new TextBox(); txt.ID = "rgsSoyadi"; txt.MaxLength = 15; CustomizeControl1.AddControl(onEk + "Soyadı", txt); txt = new TextBox(); txt.ID = "rgsMail"; txt.CssClass = "form-control"; txt.TextMode = TextBoxMode.Email; txt.MaxLength = 60; CustomizeControl1.AddControl("Giriş Maili", txt, "* Bu mail adresi kimseyle paylaşılmaz sadece sisteme giriş için kullanılır."); txt = new TextBox(); txt.ID = "rgsSifre"; txt.CssClass = "form-control"; txt.TextMode = TextBoxMode.Password; txt.MaxLength = 25; CustomizeControl1.AddControl("Şifre", txt, "* Sisteme giriş yapmanız için gerekli olacak."); DateTimeControl cnt = this.Page.LoadControl(Settings.DateTimeControlPath) as DateTimeControl; cnt.ID = "rgsDogumTarihi"; cnt.FormatType = FormatTypes.BirthDate; CustomizeControl1.AddControl("Doğum Tarihi", cnt, "* Seçilmesi zorunlu alan."); DropDownList ddl = new DropDownList(); ddl.ID = "rgsCinsiyet"; ddl.Width = 195; ddl.CssClass = "form-control"; ddl.DataValueField = "Key"; ddl.DataTextField = "Value"; ddl.DataSource = Core.GetSexTypes(); ddl.DataBind(); CustomizeControl1.AddControl("Cinsiyet", ddl); CheckBox chk = new CheckBox(); chk.ID = "rgsAbonelik"; chk.Checked = true; CustomizeControl1.AddControl("Abonelik", chk); }
private void AddNewRow() { Table tbl = (Table)this.FindControl("tblUsers"); //table Cells Controls TextBox txt1 = new TextBox(); txt1.Height = 19; TextBox txt2 = new TextBox(); txt2.Height = 19; TextBox txt3 = new TextBox(); txt3.Height = 19; DateTimeControl dt1 = new DateTimeControl(); dt1.DateOnly = true; DateTimeControl dt2 = new DateTimeControl(); dt2.DateOnly = true; TableRow tRow = new TableRow(); TableCell tCellOne = new TableCell(); tCellOne.Controls.Add(txt1); tRow.Cells.Add(tCellOne); TableCell tCellTwo = new TableCell(); tCellTwo.Controls.Add(dt1); tRow.Cells.Add(tCellTwo); TableCell tCellThree = new TableCell(); tCellThree.Controls.Add(dt2); tRow.Cells.Add(tCellThree); TableCell tCellFour = new TableCell(); tCellFour.Controls.Add(txt2); tRow.Cells.Add(tCellFour); TableCell tCellFive = new TableCell(); tCellFive.Controls.Add(txt3); tRow.Cells.Add(tCellFive); tbl.Rows.Add(tRow); }
public void UCITestCreateActivity_ClearDateTimes() { var client = new WebClient(TestSettings.Options); using (var xrmApp = new XrmApp(client)) { xrmApp.OnlineLogin.Login(_xrmUri, _username, _password, _mfaSecrectKey); xrmApp.Navigation.OpenApp(UCIAppName.Sales); xrmApp.Navigation.OpenSubArea("My Work", "Activities"); xrmApp.CommandBar.ClickCommand("Appointment"); xrmApp.ThinkTime(5000); xrmApp.Entity.SetValue("subject", "Appointment " + TestSettings.GetRandomString(5, 10)); DateTime expectedDate = DateTime.Today.AddDays(1).AddHours(10); DateTime expectedEndDate = expectedDate.AddHours(2); //xrmApp.Entity.SetValue("scheduledstart", expectedDate); var start = new DateTimeControl("scheduledstart") { Value = expectedDate }; xrmApp.Entity.SetValue(start); DateTime?date = xrmApp.Entity.GetValue(start); Assert.AreEqual(expectedDate, date); //xrmApp.Entity.SetValue("scheduledend", expectedEndDate); var end = new DateTimeControl("scheduledend") { Value = expectedEndDate }; xrmApp.Entity.SetValue(end); date = xrmApp.Entity.GetValue(end); Assert.AreEqual(expectedEndDate, date); xrmApp.Entity.ClearValue(start); date = xrmApp.Entity.GetValue(start); Assert.AreEqual(null, date); xrmApp.Entity.ClearValue(end); date = xrmApp.Entity.GetValue(end); Assert.AreEqual(null, date); } }
private void InitializeCustomControls() { InitBar(); this.ddlReceiver = (DropDownList)GetControltByMaster("ddlReceiver"); this.btnSave = (Button)GetControltByMaster("btnSave"); this.btnSave.Click += new EventHandler(btnSave_Click); this.txtNoticeCode = (TextBox)GetControltByMaster("txtNoticeCode"); this.txtRemark = (TextBox)GetControltByMaster("txtRemark"); vldNoticeCode = (CustomValidator)GetControltByMaster("vldNoticeCode"); vldNoticeCode.ServerValidate += new ServerValidateEventHandler(vldNoticeCode_ServerValidate); dtcCreateTime = GetControltByMaster("dtcCreateTime") as DateTimeControl; }
/// <summary> /// 初始化页面控件 /// </summary> private void InitControl() { this.txtFiduciary = (TextBox)GetControltByMaster("txtFiduciary"); this.lblPrincipal = (Label)GetControltByMaster("lblPrincipal"); this.ddlTaskType = (DropDownList)GetControltByMaster("ddlTaskType"); this.StartTime = (DateTimeControl)GetControltByMaster("StartTime"); this.EndTime = (DateTimeControl)GetControltByMaster("EndTime"); this.txtRemark = (TextBox)GetControltByMaster("txtRemark"); this.btnSave = (Button)GetControltByMaster("btnSave"); btnSave.Attributes.Add("onclick", "return confirm('受托人将具有委托人对此任务类型的所有审批权力,确定这样做么?');"); this.btnQuit = (Button)GetControltByMaster("btnQuit"); this.btnSave.Click += new EventHandler(btnSave_Click); this.btnQuit.CausesValidation = false; this.btnQuit.Click += new EventHandler(btnQuit_Click); }
private void InitControl() { InitBar(); this.ddlProject = (DropDownList)GetControltByMaster("ddlProject"); this.ddlCompany = (DropDownList)GetControltByMaster("ddlCompany"); this.ddlCompany.SelectedIndexChanged += new EventHandler(ddlCompany_SelectedIndexChanged); this.dtcCreateTime = GetControltByMaster("dtcCreateTime") as DateTimeControl; this.btnSave = (Button)GetControltByMaster("btnSave"); this.btnSave.Click += new EventHandler(btnSave_Click); this.txtTaker = (TextBox)GetControltByMaster("txtTaker"); ((Literal)GetControltByMaster("ltrTaker")).Text = JSDialogAid.GetJSForDialog(txtTaker.ClientID, "../StorageAndPile/SelectUser.aspx"); this.txtRemark = (TextBox)GetControltByMaster("txtRemark"); }
protected void oGridView_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { Label id = (Label)oGridView.Rows[e.RowIndex].Cells[0].FindControl("lblID"); TextBox Name = (TextBox)oGridView.Rows[e.RowIndex].Cells[1].FindControl("txtname"); DropDownList Domain = (DropDownList)oGridView.Rows[e.RowIndex].Cells[3].FindControl("drpdomain"); TextBox Experience = (TextBox)oGridView.Rows[e.RowIndex].Cells[4].FindControl("txtexperience"); TextBox SkillSets = (TextBox)oGridView.Rows[e.RowIndex].Cells[5].FindControl("txtskillset"); TextBox CurrentCTC = (TextBox)oGridView.Rows[e.RowIndex].Cells[6].FindControl("txtcrtctc"); TextBox ExpectedCTC = (TextBox)oGridView.Rows[e.RowIndex].Cells[6].FindControl("txtexctc"); Label Remarks = (Label)oGridView.Rows[e.RowIndex].Cells[6].FindControl("lblremark"); TextBox Email = (TextBox)oGridView.Rows[e.RowIndex].Cells[6].FindControl("txtemail"); TextBox ContactNo = (TextBox)oGridView.Rows[e.RowIndex].Cells[6].FindControl("txtcontact"); if (oGridView.EditIndex == -1) { return; } FileUpload UploadedResume = (FileUpload)oGridView.Rows[e.RowIndex].Cells[6].FindControl("FileUpload2") as FileUpload; string fileName = UploadedResume.FileName; //string fullPath = Path.GetFullPath(fileName); //UploadedResume.SaveAs(fullPath); Label Interviewer = (Label)oGridView.Rows[e.RowIndex].Cells[6].FindControl("lblinterviewer"); //PeopleEditor Interviewer = (PeopleEditor)oGridView.Rows[e.RowIndex].Cells[6].FindControl("PeopleEditor1"); DropDownList Status = (DropDownList)oGridView.Rows[e.RowIndex].Cells[6].FindControl("drpStatus"); DateTimeControl InterviewDate = (DateTimeControl)oGridView.Rows[e.RowIndex].Cells[6].FindControl("DateTimeControl2"); SPSecurity.RunWithElevatedPrivileges(delegate() { UpdateRow(id.Text, Name.Text, Domain.SelectedValue, Experience.Text, SkillSets.Text, CurrentCTC.Text, ExpectedCTC.Text, Remarks.Text, Email.Text, ContactNo.Text, UploadedResume.FileName, Interviewer.Text, Status.SelectedValue, InterviewDate.SelectedDate.Date.ToString()); oGridView.EditIndex = -1; bindview(); }); } catch (Exception ex) { // oException.Exception(ex.Message.ToString(), ex.StackTrace.ToString(), "oGridView_RowUpdating"); } }
private void InitializeCustomControls() { InitToolBar(); txtCode = (TextBox)GetControltByMaster("txtCode"); txtRemark = (TextBox)GetControltByMaster("txtRemark"); dtcCreateTime = (DateTimeControl)GetControltByMaster("dtcCreateTime"); btnOK = (Button)GetControltByMaster("btnOK"); btnOK.Click += new EventHandler(btnOK_Click); //初始化spgvMaterial this.spgvMaterial = new SPGridView(); this.spgvMaterial.AutoGenerateColumns = false; this.spgvMaterial.Attributes.Add("style", "word-break:keep-all;word-wrap:normal"); BoundField bfColumn; foreach (var kvp in ShowTlist) { bfColumn = new BoundField(); bfColumn.HeaderText = kvp.Split(':')[0]; bfColumn.DataField = kvp.Split(':')[1]; this.spgvMaterial.Columns.Add(bfColumn); } //单价 TemplateField tfUnitPrice = new TemplateField(); tfUnitPrice.HeaderText = "单价"; tfUnitPrice.ItemTemplate = new TextBoxTemplate("UnitPrice", "UnitPrice", "^(-?\\d+)(\\.\\d+)?$", "0", 80); this.spgvMaterial.Columns.Insert(8, tfUnitPrice); TemplateField tfCurUnit = new TemplateField(); tfCurUnit.HeaderText = "计量单位"; tfCurUnit.ItemTemplate = new DropDownListTemplate("CurUnit", DataControlRowType.DataRow, new string[] { "根/台/套/件", "米", "吨" }); this.spgvMaterial.Columns.Insert(9, tfCurUnit); //加入备注列 TemplateField tfRemark = new TemplateField(); tfRemark.HeaderText = "备注"; tfRemark.ItemTemplate = new TextBoxTemplate("备注", DataControlRowType.DataRow, "Remark"); this.spgvMaterial.Columns.Insert(11, tfRemark); }
internal static void InitializeDatePicker(DateTimeControl datePicker) { SPWeb web = SPContext.Current.Web; SPRegionalSettings regionalSettings = web.CurrentUser.RegionalSettings; if (regionalSettings == null) { regionalSettings = web.RegionalSettings; } datePicker.LocaleId = (int)regionalSettings.LocaleId; datePicker.TimeZoneID = regionalSettings.TimeZone.ID; datePicker.UseTimeZoneAdjustment = false; datePicker.HijriAdjustment = regionalSettings.AdjustHijriDays; datePicker.HoursMode24 = true; //regionalSettings.Time24; datePicker.Calendar = (SPCalendarType)regionalSettings.CalendarType; datePicker.DatePickerFrameUrl = SPContext.Current.Web.ServerRelativeUrl + "/_layouts/iframe.aspx"; }
protected override void CreateChildControls() { Controls.Clear(); if (Field == null) { return; } if (Field.ReadOnly || ControlMode == SPControlMode.Display) { ctrl_Label = new Label { ID = Field.InternalName }; this.Controls.Add(ctrl_Label); } else { ctrl_DateCtrl = new DateTimeControl { ID = Field.InternalName, DateOnly = (((DbFieldDateTime)Field).Format == "DateOnly") }; var regSettings = SPContext.Current.Web.RegionalSettings; if (regSettings != null) { ctrl_DateCtrl.Calendar = ((SPCalendarType)regSettings.CalendarType); ctrl_DateCtrl.LocaleId = ((int)regSettings.LocaleId); ctrl_DateCtrl.UseTimeZoneAdjustment = true; ctrl_DateCtrl.HijriAdjustment = regSettings.AdjustHijriDays; ctrl_DateCtrl.HoursMode24 = regSettings.Time24; ctrl_DateCtrl.FirstDayOfWeek = ((int)regSettings.FirstDayOfWeek); ctrl_DateCtrl.FirstWeekOfYear = regSettings.FirstWeekOfYear; ctrl_DateCtrl.ShowWeekNumber = regSettings.ShowWeeks; ctrl_DateCtrl.TimeZoneID = regSettings.TimeZone.ID; ctrl_DateCtrl.DatePickerFrameUrl = SPContext.Current.Web.ServerRelativeUrl.TrimEnd('/') + "/" + ctrl_DateCtrl.DatePickerFrameUrl.TrimStart('/'); } if (Field.Required) { ctrl_DateCtrl.IsRequiredField = true; ctrl_DateCtrl.ErrorMessage = "You can't leave this blank"; } Controls.Add(ctrl_DateCtrl); } }
public static string GetFieldValueAsTextEx(this SPFieldCalculated calcField, Control control, bool ignoreValidation) { string value = string.Empty; switch (calcField.OutputType) { case SPFieldType.Number: case SPFieldType.Currency: TextBox txtNumber = (TextBox)control; if (!ignoreValidation && string.IsNullOrEmpty(txtNumber.Text)) { break; } value = txtNumber.Text; break; case SPFieldType.DateTime: DateTimeControl dtcValueDate = (DateTimeControl)control; if (!ignoreValidation && dtcValueDate.IsDateEmpty) { break; } value = SPUtility.CreateISO8601DateTimeFromSystemDateTime(dtcValueDate.SelectedDate); break; case SPFieldType.Boolean: CheckBox chkField = (CheckBox)control; value = chkField.Checked ? "1" : "0"; break; default: TextBox txtString = (TextBox)control; if (!ignoreValidation && string.IsNullOrEmpty(txtString.Text)) { break; } value = txtString.Text; break; } return(value); }
public bool SendMailReliabilityReportMonthly() { try { DateTimeControl.ReturnDateTimeForMonthly(ref dateFrom, ref dateTo); RealabilityReport realabilityReport = new RealabilityReport(); List <ReliabilitySummary> ListReliability = new List <ReliabilitySummary>(); List <ReliabilitySummary> ListReliabilityDept = new List <ReliabilitySummary>(); ListReliability = realabilityReport.GetDataForReliability(dateFrom, dateTo, out ListReliabilityDept); ExportExcelTool exportExcelTool = new ExportExcelTool(); string path = @"C:\ERP_Temp\Reliability_Report_" + DateTime.Now.ToString("ddMMyy HHmmss") + ".xlsx"; exportExcelTool.ExportToReliabilityReport(pathTemplate, path, ListReliability, ListReliabilityDept, dateFrom, dateTo); } catch (Exception ex) { Logfile.Output(StatusLog.Error, "SendMailReliabilityReportWeekly()", ex.Message); return(false); } return(true); }
public static Control SetValueToControl(this SPFieldCalculated calcField, Control control, string value) { switch (calcField.OutputType) { case SPFieldType.DateTime: DateTimeControl dtcValueDate = (DateTimeControl)control; dtcValueDate.SelectedDate = Convert.ToDateTime(value).ToUniversalTime(); break; case SPFieldType.Boolean: CheckBox chkField = (CheckBox)control; chkField.Checked = Convert.ToBoolean(Convert.ToByte(value)); break; default: TextBox txtInput = (TextBox)control; txtInput.Text = value; break; } return(control); }
protected override void CreateChildControls() { if (Field == null) return; base.CreateChildControls(); if (ControlMode == SPControlMode.Display) return; TheDatePicker = (DateTimeControl)TemplateContainer.FindControl("TheDatePicker"); TheDatePicker.DateOnly = true; if (TheDatePicker.Equals(null)) { throw new ArgumentException("Corrupt DateTimeByMinuteTemplate - Date Missing"); } TheDatePicker.TabIndex = TabIndex; TheDatePicker.ToolTip = Field.Title + " Date"; DropDownHH = (DropDownList)TemplateContainer.FindControl("DropDownHH"); if (DropDownHH.Equals(null)) { throw new ArgumentException("Corrupt DateTimeByMinuteTemplate - HH Missing"); } DropDownHH.TabIndex = TabIndex; DropDownHH.CssClass = CssClass; DropDownHH.ToolTip = Field.Title + " Hour"; DropDownMM = (DropDownList)TemplateContainer.FindControl("DropDownMM"); if (DropDownMM.Equals(null)) { throw new ArgumentException("Corrupt DateTimeByMinuteTemplate - MM Missing"); } DropDownMM.TabIndex = TabIndex; DropDownMM.CssClass = CssClass; DropDownMM.ToolTip = Field.Title + " Minute"; if (ControlMode == SPControlMode.New) { DropDownHH.Text = Field.GetCustomProperty("DefaultHH").ToString(); DropDownMM.Text = Field.GetCustomProperty("DefaultMM").ToString(); } }
public Control BuildValueSelectorControl(SPField field, string displayValue) { Control control = null; if (field == null) { control = new TextBox() { CssClass = "ms-long", Text = displayValue.ToString() }; } else { switch (field.Type) { case SPFieldType.Boolean: CheckBox checkbox = new CheckBox() { }; if (!string.IsNullOrEmpty(displayValue)) { bool value; if (bool.TryParse(displayValue, out value)) { checkbox.Checked = value; } } control = checkbox; break; case SPFieldType.File: case SPFieldType.Calculated: case SPFieldType.Computed: case SPFieldType.Currency: case SPFieldType.Integer: case SPFieldType.Note: case SPFieldType.Number: case SPFieldType.Text: case SPFieldType.URL: case SPFieldType.Invalid: control = new TextBox() { CssClass = "ms-long", Text = displayValue.ToString() }; break; case SPFieldType.Choice: SPFieldChoice fieldChoice = (SPFieldChoice)field; DropDownList ddlValueChoice = new DropDownList(); foreach (string value in fieldChoice.Choices) { ddlValueChoice.Items.Add(new ListItem(value)); } ddlValueChoice.Items.Insert(0, string.Empty); ddlValueChoice.SelectedIndex = ddlValueChoice.Items.IndexOf(ddlValueChoice.Items.FindByValue(displayValue)); control = ddlValueChoice; break; case SPFieldType.DateTime: SPFieldDateTime fieldDate = (SPFieldDateTime)field; DateTimeControl dtcValueDate = new DateTimeControl(); dtcValueDate.DateOnly = (fieldDate.DisplayFormat == SPDateTimeFieldFormatType.DateOnly); if (!string.IsNullOrEmpty(displayValue.ToString())) { DateTime date; if (DateTime.TryParse(displayValue.ToString(), out date)) { dtcValueDate.SelectedDate = Convert.ToDateTime(date).ToUniversalTime(); } } control = dtcValueDate; break; case SPFieldType.Lookup: SPFieldLookup fieldLookup = (SPFieldLookup)field; control = generateLookupControl(control, fieldLookup, displayValue); break; case SPFieldType.MultiChoice: SPFieldMultiChoice fieldMultichoice = (SPFieldMultiChoice)field; CheckBoxList chkValueMultiChoice = new CheckBoxList(); foreach (string value in fieldMultichoice.Choices) { ListItem item = new ListItem(value); string[] arr = displayValue.Split(SEPARATOR.ToCharArray()); item.Selected = arr.Contains(value); chkValueMultiChoice.Items.Add(item); } control = chkValueMultiChoice; HtmlGenericControl div2 = new HtmlGenericControl("div"); div2.Attributes.Add("style", "overflow: auto;height:100px;width:100%;"); div2.Controls.Add(chkValueMultiChoice); control = div2; break; case SPFieldType.User: SPFieldUser fieldUser = (SPFieldUser)field; PeopleEditor peoValue = new PeopleEditor() { CssClass = "ms-long" }; peoValue.MultiSelect = fieldUser.AllowMultipleValues; peoValue.SelectionSet = (fieldUser.SelectionMode == SPFieldUserSelectionMode.PeopleOnly) ? "User" : "User,SPGroup "; if (!string.IsNullOrEmpty(displayValue)) { string[] arr = displayValue.Split(SEPARATOR.ToCharArray()); ArrayList list = new ArrayList(); foreach (string s in arr) { PickerEntity peMember = new PickerEntity(); string[] arrPeMember = s.Split('#'); peMember.Key = arrPeMember[1]; peMember = peoValue.ValidateEntity(peMember); list.Add(peMember); } peoValue.UpdateEntities(list); } control = peoValue; break; default: control = new TextBox() { CssClass = "ms-long", Text = displayValue }; break; } } control.ID = GENERIC_CONTROL_ID; return control; }
private string DokumentValidation(Label lblNamaFile, DropDownList ddlTipeDokumen, DropDownList ddlSoftcopyOriginal, TextBox txtTujuanPeminjaman, DateTimeControl dtTglDibutuhkan) { StringBuilder sb = new StringBuilder(); if (lblNamaFile.Text.Trim() == string.Empty) sb.Append(SR.FieldCanNotEmpty("Nama Dokumen") + " \\n"); if (ddlTipeDokumen.SelectedValue == string.Empty) sb.Append(SR.FieldCanNotEmpty("Tipe Dokumen") + " \\n"); if (ddlSoftcopyOriginal.SelectedValue == string.Empty) sb.Append(SR.FieldCanNotEmpty("Softcopy/Original") + " \\n"); if (txtTujuanPeminjaman.Text.Trim() == string.Empty) sb.Append(SR.FieldCanNotEmpty("Tujuan Peminjaman") + " \\n"); if (dtTglDibutuhkan.IsDateEmpty || dtTglDibutuhkan.ErrorMessage != null) sb.Append(SR.FieldCanNotEmpty("Tanggal dibutuhkan") + " \\n"); //if (ViewState["Status"].ToString() == CUSTODIAN_UPDATE_TANGGAL_ESTIMASI_PENGEMBALIAN) //{ // if (dtTglEstimasiPengembalian.IsDateEmpty || dtTglEstimasiPengembalian.ErrorMessage != null) // sb.Append(SR.FieldCanNotEmpty("Tanggal Estimasi Pengembalian") + " \\n"); // if (!dtTglEstimasiPengembalian.IsDateEmpty) // { // int i = DateTime.Compare(dtTglDibutuhkan.SelectedDate, dtTglEstimasiPengembalian.SelectedDate); // if (i > 0) // sb.Append("Tanggal Estimasi Pengembalian must be greater or equal than Tanggal dibutuhkan\\n"); // } //} return sb.ToString(); }