private void ApppyButton_Click(object sender, EventArgs e) { Button button = sender as Button; int permissionID = int.Parse(button.ID.Replace(applyChar, "")); GMDatePicker sinceDatePicker = (button.Parent.Parent as TableRow).Cells[2].Controls[0] as GMDatePicker; GMDatePicker tillDatePicker = (button.Parent.Parent as TableRow).Cells[4].Controls[0] as GMDatePicker; TblPermissions permission = ServerModel.DB.Load <TblPermissions>(permissionID); if (sinceDatePicker.IsNull) { permission.DateSince = null; } else { permission.DateSince = sinceDatePicker.Date; sinceDatePicker.Date = sinceDatePicker.Date; } if (tillDatePicker.IsNull) { permission.DateTill = null; } else { permission.DateTill = tillDatePicker.Date; tillDatePicker.Date = tillDatePicker.Date; } ServerModel.DB.Update <TblPermissions>(permission); }
protected void btnApprove_Click(object sender, EventArgs e) { string strSpeedoUrl = ConfigurationManager.AppSettings["SpeedoUrl"].ToString(); using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["Speedo"].ToString())) { cn.Open(); SqlCommand cmd = cn.CreateCommand(); cmd.CommandText = "UPDATE CIS.Mrcf SET headstat='A',sprvstat=@sprvstat,headdate='" + DateTime.Now + "',headrem=@headrem,intended=@intended WHERE mrcfcode='" + Request.QueryString["mrcfcode"] + "'"; cmd.Parameters.Add("@sprvstat", SqlDbType.Char, 1); cmd.Parameters.Add("@headrem", SqlDbType.VarChar, 200); cmd.Parameters.Add("@intended", SqlDbType.VarChar, 100); cmd.Parameters["@sprvstat"].Value = (hdnGrpHeadStat.Value == "F" ? "N" : hdnGrpHeadStat.Value); cmd.Parameters["@headrem"].Value = txtDiviHeadRem.Text; cmd.Parameters["@intended"].Value = txtIntended.Text; cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); cmd.CommandText = "UPDATE CIS.MrcfDetails SET itemdesc=@itemdesc,itemspec=@itemspec,qty=@qty,dateneed=@dateneed WHERE mitmcode=@mitmcode"; cmd.Parameters.Add("@itemdesc", SqlDbType.VarChar, 100); cmd.Parameters.Add("@itemspec", SqlDbType.VarChar, 5000); cmd.Parameters.Add("@qty", SqlDbType.Int); cmd.Parameters.Add("@dateneed", SqlDbType.DateTime); cmd.Parameters.Add("@mitmcode", SqlDbType.BigInt); foreach (DataGridItem itm in dgItems.Items) { HiddenField phdnMitmCode = (HiddenField)itm.FindControl("hdnMitmCode"); TextBox ptxtItemDesc = (TextBox)itm.FindControl("txtItemDesc"); TextBox ptxtItemSpec = (TextBox)itm.FindControl("txtItemSpec"); TextBox ptxtQty = (TextBox)itm.FindControl("txtQty"); GMDatePicker pdteDateNeeded = (GMDatePicker)itm.FindControl("dteDateNeeded"); cmd.Parameters["@itemdesc"].Value = ptxtItemDesc.Text; cmd.Parameters["@itemspec"].Value = ptxtItemSpec.Text; cmd.Parameters["@qty"].Value = ptxtQty.Text; cmd.Parameters["@dateneed"].Value = pdteDateNeeded.Date; cmd.Parameters["@mitmcode"].Value = phdnMitmCode.Value; cmd.ExecuteNonQuery(); } } clsMRCF mrcf = new clsMRCF(txtMrcfCode.Text); mrcf.CheckDateNeeded(); clsMRCF.SendNotification(clsMRCF.MRCFMailType.SentToApproverPM, txtRequestorName.Text, txtProcMngrName.Text, hdnProcMngrMail.Value, txtMrcfCode.Text); clsMRCF.SendNotification(clsMRCF.MRCFMailType.ApproveToRequestor, txtRequestorName.Text, txtDiviHeadName.Text, hdnRequestorMail.Value, txtMrcfCode.Text); clsMRCF.SendNotification(clsMRCF.MRCFMailType.ApproveToApproverDH, txtRequestorName.Text, txtDiviHeadName.Text, clsUsers.GetEmail(Request.Cookies["Speedo"]["UserName"].ToString()), txtMrcfCode.Text); Response.Redirect("MRCFMenu.aspx"); }
private GMDatePicker recreateDatePicker(string ID) { GMDatePicker DatePicker = new GMDatePicker(); DatePicker.ID = ID; DatePicker.EnableTimePicker = true; DatePicker.DisplayMode = DisplayMode.Label; DatePicker.InitialValueMode = InitialValueMode.Null; DatePicker.InitialText = noDateSelected; DatePicker.NoneText = noDateSelected; DatePicker.CalendarTheme = CalendarTheme.Silver; DatePicker.TimeGranularity = 5; return(DatePicker); }
protected void btnChildSave_Click(object sender, EventArgs e) { foreach (DataGridItem itm in dgChildren.Items) { HiddenField phdnListChildCode = (HiddenField)itm.FindControl("hdnListChildCode"); TextBox ptxtListChildName = (TextBox)itm.FindControl("txtListChildName"); GMDatePicker pdtpListChildBirthdate = (GMDatePicker)itm.FindControl("dtpListChildBirthdate"); clsEmployeeChildren ec = new clsEmployeeChildren(); ec.ChildCode = phdnListChildCode.Value; ec.Name = ptxtListChildName.Text.Substring(0, 100); ec.Birthdate = pdtpListChildBirthdate.Date; ec.Edit(); } BindChildrenList(); }
protected void btnDependentSave_Click(object sender, EventArgs e) { foreach (DataGridItem itm in dgDependent.Items) { HiddenField phdnListDependentCode = (HiddenField)itm.FindControl("hdnListDependentCode"); TextBox ptxtListDependentName = (TextBox)itm.FindControl("txtListDependentName"); GMDatePicker pdtpListDependentBirthdate = (GMDatePicker)itm.FindControl("dtpListDependentBirthdate"); TextBox ptxtListDependentRelation = (TextBox)itm.FindControl("txtListDependentRelation"); clsEmployeeDependent ed = new clsEmployeeDependent(); ed.DependentCode = phdnListDependentCode.Value; ed.Name = ptxtListDependentName.Text; ed.Birthdate = pdtpListDependentBirthdate.Date; ed.Relation = ptxtListDependentRelation.Text; ed.Edit(); } BindDependentList(); }
protected void btnSave_Click(object sender, EventArgs e) { TextBox captionText = new TextBox(); TextBox locationText = new TextBox(); TextBox despText = new TextBox(); TextBox titleText = new TextBox(); GMDatePicker datep = new GMDatePicker(); string caption = null; string location = null; string desp = null; string title = null; string id = null; DateTime adddate; foreach (DataListItem dataItem in DataList1.Items) { captionText = (TextBox)dataItem.FindControl("txtCaption"); locationText = (TextBox)dataItem.FindControl("txtLocation"); despText = (TextBox)dataItem.FindControl("txtDescription"); titleText = (TextBox)dataItem.FindControl("txtName"); datep = (GMDatePicker)dataItem.FindControl("GMDatePicker1"); caption = captionText.Text.ToString().Trim(); location = locationText.Text.ToString().Trim(); desp = despText.Text.ToString().Trim(); title = titleText.Text.ToString().Trim(); adddate = datep.Date; string Id = ((HiddenField)dataItem.FindControl("HiddenField1")).Value; MediaBO objClass = new MediaBO(); objClass.Id = Id; objClass.Location = location; objClass.Caption = caption; objClass.Name = title; objClass.Description = desp; objClass.AddedDate = adddate; objClass.Type= Global.VIDEO; MediaBLL.updateEditVideoMedia(objClass); } LoadDataListMedia(); }
protected void btnSave_Click(object sender, EventArgs e) { TextBox captionText = new TextBox(); TextBox locationText = new TextBox(); TextBox despText = new TextBox(); TextBox titleText = new TextBox(); GMDatePicker datep = new GMDatePicker(); string caption = null; string location = null; string desp = null; string title = null; string id = null; DateTime adddate; foreach (DataListItem dataItem in DataList1.Items) { captionText = (TextBox)dataItem.FindControl("txtCaption"); locationText = (TextBox)dataItem.FindControl("txtLocation"); despText = (TextBox)dataItem.FindControl("txtDescription"); titleText = (TextBox)dataItem.FindControl("txtName"); datep = (GMDatePicker)dataItem.FindControl("GMDatePicker1"); caption = captionText.Text.ToString().Trim(); location = locationText.Text.ToString().Trim(); desp = despText.Text.ToString().Trim(); title = titleText.Text.ToString().Trim(); adddate = datep.Date; string Id = ((HiddenField)dataItem.FindControl("HiddenField1")).Value; MediaBO objClass = new MediaBO(); objClass.Id = Id; objClass.Location = location; objClass.Caption = caption; objClass.Name = title; objClass.Description = desp; objClass.AddedDate = adddate; objClass.Type = Global.VIDEO; MediaBLL.updateEditVideoMedia(objClass); } LoadDataListMedia(); }
protected void btnSave_Click(object sender, EventArgs e) { foreach (DataGridItem itm in dgTraining.Items) { HiddenField phdnTraiCode = (HiddenField)itm.FindControl("hdnTraiCode"); GMDatePicker pdtpTrainingDate = (GMDatePicker)itm.FindControl("dtpTrainingDate"); TextBox ptxtTraining = (TextBox)itm.FindControl("txtTraining"); TextBox ptxtDetails = (TextBox)itm.FindControl("txtDetails"); TextBox ptxtSponsor = (TextBox)itm.FindControl("txtSponsor"); clsEmployeeTraining et = new clsEmployeeTraining(); et.TrainingCode = phdnTraiCode.Value; et.TrainingDate = pdtpTrainingDate.Date; et.Training = ptxtTraining.Text; et.Sponsor = (ptxtSponsor.Text.Length > 50 ? ptxtSponsor.Text.Substring(0, 50) : ptxtSponsor.Text); et.Details = (ptxtDetails.Text.Length > 255 ? ptxtDetails.Text.Substring(0, 255) : ptxtDetails.Text); et.Edit(); } BindTrainingList(); }
protected void dgItems_UpdateCommand(object source, DataGridCommandEventArgs e) { HiddenField phdnDateEntry = (HiddenField)e.Item.FindControl("hdnDateEntry"); TextBox ptxtRecBy = (TextBox)e.Item.FindControl("txtRecBy"); GMDatePicker pdteRecDate = (GMDatePicker)e.Item.FindControl("dteRecDate"); using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["Speedo"].ToString())) { SqlCommand cmd = cn.CreateCommand(); cmd.CommandText = "UPDATE CM.CrsDetailsDispatch SET recby=@recby,recdate=@recdate WHERE crscode='" + Request.QueryString["crscode"] + "' AND crsecode='" + Request.QueryString["crsecode"] + "' AND datentry='" + phdnDateEntry.Value + "'"; cmd.Parameters.Add("@recby", SqlDbType.VarChar, 30); cmd.Parameters.Add("@recdate", SqlDbType.DateTime); cmd.Parameters["@recby"].Value = ptxtRecBy.Text; cmd.Parameters["@recdate"].Value = pdteRecDate.Date; cn.Open(); cmd.ExecuteNonQuery(); } dgItems.EditItemIndex = -1; BindItems(); }
private GMDatePicker recreateDatePicker(string ID) { GMDatePicker DatePicker = new GMDatePicker(); DatePicker.ID = ID; DatePicker.EnableTimePicker = true; DatePicker.DisplayMode = DisplayMode.Label; DatePicker.InitialValueMode = InitialValueMode.Null; DatePicker.InitialText = noDateSelected; DatePicker.NoneText = noDateSelected; DatePicker.CalendarTheme = CalendarTheme.Silver; DatePicker.TimeGranularity = 5; return DatePicker; }
private TableRow buildPermissionRow(TblPermissions permission) { TableRow operationRow = new TableRow(); Label dateSinceLabel = new Label(); dateSinceLabel.Text = since + ": "; GMDatePicker dateSinceDatePicker = recreateDatePicker(since + permission.ID.ToString()); Label dateTillLabel = new Label(); dateTillLabel.Text = till + ": "; GMDatePicker dateTillDatePicker = recreateDatePicker(till + permission.ID.ToString()); TableCell operationNameCell = new TableCell(); if (permission.StageOperationRef.HasValue) { FxStageOperations stageOperation = ServerModel.DB.Load <FxStageOperations>(permission.StageOperationRef.Value); operationNameCell.Text = stageOperation.Name; } if (permission.CurriculumOperationRef.HasValue) { FxCurriculumOperations curriculumOperation = ServerModel.DB.Load <FxCurriculumOperations>(permission.CurriculumOperationRef.Value); operationNameCell.Text = curriculumOperation.Name; } operationRow.Cells.Add(operationNameCell); Table layoutTable = new Table(); TableRow layoutRow = new TableRow(); TableCell sinceLabelCell = new TableCell(); sinceLabelCell.Controls.Add(dateSinceLabel); TableCell sincePickerCell = new TableCell(); sincePickerCell.HorizontalAlign = HorizontalAlign.Right; sincePickerCell.Controls.Add(dateSinceDatePicker); TableCell tillLabelCell = new TableCell(); tillLabelCell.Controls.Add(dateTillLabel); TableCell tillPickerCell = new TableCell(); tillPickerCell.HorizontalAlign = HorizontalAlign.Right; tillPickerCell.Controls.Add(dateTillDatePicker); operationRow.Cells.Add(sinceLabelCell); operationRow.Cells.Add(sincePickerCell); operationRow.Cells.Add(tillLabelCell); operationRow.Cells.Add(tillPickerCell); if (permission.DateSince.HasValue) { dateSinceDatePicker.InitialText = permission.DateSince.Value.ToShortDateString(); dateSinceDatePicker.InitialTimePickerText = permission.DateSince.Value.ToShortTimeString(); } if (permission.DateTill.HasValue) { dateTillDatePicker.InitialText = permission.DateTill.Value.ToShortDateString(); dateTillDatePicker.InitialTimePickerText = permission.DateTill.Value.ToShortTimeString(); } TableCell operationCell = new TableCell(); Button ApppyButton = new Button(); ApppyButton.ID = applyChar + permission.ID.ToString(); ApppyButton.Click += new EventHandler(ApppyButton_Click); ApppyButton.Text = apply; Button RemoveButton = new Button(); RemoveButton.ID = removeChar + permission.ID.ToString(); RemoveButton.Click += new EventHandler(RemoveButton_Click); RemoveButton.Text = remove; operationCell.Controls.Add(ApppyButton); operationCell.Controls.Add(RemoveButton); operationRow.Cells.Add(operationCell); return(operationRow); }
protected void Page_Load(object sender, EventArgs e) { clsSpeedo.Authenticate(); divErr.Visible = false; if (!Page.IsPostBack) { string strProcessScript = "this.value='Processing...';this.disabled=true;"; btnApprove.Attributes.Add("onclick", strProcessScript + ClientScript.GetPostBackEventReference(btnApprove, "").ToString()); btnApprove2.Attributes.Add("onclick", strProcessScript + ClientScript.GetPostBackEventReference(btnApprove2, "").ToString()); btnDisApprove.Attributes.Add("onclick", strProcessScript + ClientScript.GetPostBackEventReference(btnDisApprove, "").ToString()); btnDisapprove2.Attributes.Add("onclick", strProcessScript + ClientScript.GetPostBackEventReference(btnDisapprove2, "").ToString()); btnModification2.Attributes.Add("onclick", strProcessScript + ClientScript.GetPostBackEventReference(btnModification2, "").ToString()); btnModify.Attributes.Add("onclick", strProcessScript + ClientScript.GetPostBackEventReference(btnModify, "").ToString()); clsMRCF.AuthenticateUser(clsMRCF.MRCFUserType.DivisionHead, Request.Cookies["Speedo"]["UserName"].ToString(), Request.QueryString["mrcfcode"].ToString()); bool blnReadOnly = false; txtMrcfCode.Text = Request.QueryString["mrcfcode"]; txtDiviHeadName.Text = clsUsers.GetName(Request.Cookies["Speedo"]["UserName"]); clsMRCF mrcf = new clsMRCF(txtMrcfCode.Text); mrcf.Fill(); hdnRequestor.Value = mrcf.Username; hdnReqType.Value = mrcf.RequestType; txtReqType.Text = mrcf.RequestTypeDesc; txtDateReq.Text = mrcf.DateRequested.ToString("MMMM dd, yyyy"); txtIntended.Text = mrcf.Intended; hdnChargeTo.Value = mrcf.ChargeTo; hdnGrpHeadCode.Value = mrcf.GroupHead; txtGrpHeadRem.Text = mrcf.GroupHeadRemarks; hdnGrpHeadStat.Value = mrcf.GroupHeadStatus; txtDiviHeadRem.Text = mrcf.DivisionHeadRemarks; hdnDiviHeadStatus.Value = mrcf.DivisionHeadStatus; hdnProcMngrCode.Value = mrcf.ProcurementManager;; txtProcMngrRem.Text = mrcf.ProcurementManagerRemarks; txtStat.Text = mrcf.StatusDescription; blnReadOnly = (hdnDiviHeadStatus.Value == "F" ? false : true); txtRCName.Text = clsEmployee.GetRCName(hdnRequestor.Value); txtChargeTo.Text = clsRC.GetRCName(hdnChargeTo.Value); using (clsUsers users = new clsUsers()) { users.Username = hdnRequestor.Value; users.Fill(); txtRequestorName.Text = users.FullName; hdnRequestorMail.Value = users.Email; users.Username = hdnGrpHeadCode.Value; users.Fill(); txtGrpHeadName.Text = users.FullName; hdnGrpHeadMail.Value = users.Email; users.Username = hdnProcMngrCode.Value; users.Fill(); txtProcMngrName.Text = users.FullName; hdnProcMngrMail.Value = users.Email; } BindItems(); divButtons.Visible = !blnReadOnly; divButtons2.Visible = !blnReadOnly; txtDiviHeadRem.ReadOnly = blnReadOnly; txtIntended.ReadOnly = blnReadOnly; if (blnReadOnly) { foreach (DataGridItem itm in dgItems.Items) { TextBox ptxtItemDesc = (TextBox)itm.FindControl("txtItemDesc"); TextBox ptxtItemSpec = (TextBox)itm.FindControl("txtItemSpec"); TextBox ptxtQty = (TextBox)itm.FindControl("txtQty"); GMDatePicker pdteDateNeeded = (GMDatePicker)itm.FindControl("dteDateNeeded"); ptxtItemDesc.ReadOnly = blnReadOnly; ptxtItemDesc.BackColor = System.Drawing.Color.FromName("#f0f8ff"); ptxtItemSpec.ReadOnly = blnReadOnly; ptxtItemSpec.BackColor = System.Drawing.Color.FromName("#f0f8ff"); ptxtQty.ReadOnly = blnReadOnly; ptxtQty.BackColor = System.Drawing.Color.FromName("#f0f8ff"); pdteDateNeeded.Enabled = false; pdteDateNeeded.BackColor = System.Drawing.Color.FromName("#f0f8ff"); } dgItems.Columns[4].Visible = false; txtIntended.BackColor = System.Drawing.Color.FromName("#f0f8ff"); txtDiviHeadRem.BackColor = System.Drawing.Color.FromName("#f0f8ff"); } else { foreach (DataGridItem itm in dgItems.Items) { GMDatePicker pdteDateNeeded = (GMDatePicker)itm.FindControl("dteDateNeeded"); pdteDateNeeded.MinDate = clsMRCF.GetMinimumDateNeeded(hdnReqType.Value, Convert.ToDateTime(txtDateReq.Text)); } } } }