protected void previousMatchesRadGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is Telerik.Web.UI.GridDataItem) { Telerik.Web.UI.GridDataItem gridDataItem = e.Item as Telerik.Web.UI.GridDataItem; LinkButton actionLinkButton = (LinkButton)e.Item.FindControl("actionLinkButton"); if (gridDataItem["Score"].Text == "0-0,0-0") { actionLinkButton.Enabled = false; } else { int matchRequestUserId = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["UserId"]); int matchId = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["MatchId"]); string score = gridDataItem["Score"].Text; string result = gridDataItem["Result"].Text; string matchDate = gridDataItem["MatchDate"].Text; actionLinkButton.Attributes.Add("onClick", string.Format("openGameRatingWindow('{0}','{1}'); return false;", matchRequestUserId, matchId)); } int courtId = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["CourtId"]); LinkButton courtLinkButton = (LinkButton)e.Item.FindControl("courtLinkButton"); courtLinkButton.Attributes.Add("onClick", string.Format("openTennisCourtDetailsWindow({0}); return false;", courtId)); } }
protected void Print_Click(object sender, EventArgs e) { try { RadButton LBTN = (RadButton)sender; string po_id = LBTN.CommandArgument; var encrypt = new eXSecurity.Encryption(); Telerik.Web.UI.GridDataItem dataItem = (Telerik.Web.UI.GridDataItem)((Control)sender).NamingContainer; string item_id = ((Label)dataItem.FindControl("item_idLBL")).Text; if (item_id == "1") //TLD { Response.Write("<script>"); Response.Write("window.open('Reports/TLDReport.aspx?P=" + encrypt.EncryptData(po_id) + "')"); Response.Write("</script>"); } else if (item_id == "2") //SSDL { Response.Write("<script>"); Response.Write("window.open('Reports/SSDLReport.aspx?P=" + encrypt.EncryptData(po_id) + "')"); Response.Write("</script>"); } } catch (Exception ex) { Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name); } }
/// <summary> /// Handles the CheckedChanged event of the chkArchived control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void chkArchived_CheckedChanged(object sender, EventArgs e) { if (!PageBase.StopProcessing) { if (DisplayMode == ViewMode.InventoryManager && this.CompanyId.HasValue && (!(Utils.IsCompanyInventoryAdmin(this.CompanyId.Value, UserID)) && OnInformCompanyInventoryToShowErrorPopup != null)) { OnInformCompanyInventoryToShowErrorPopup(ErrorCodes.NoEditPermissionForInventory); return; } CheckBox checkbox = sender as CheckBox; Telerik.Web.UI.GridDataItem row = checkbox.NamingContainer as Telerik.Web.UI.GridDataItem; if (row != null) { BookingInfo bookingInfo = row.DataItem as BookingInfo; if (bookingInfo != null) { Booking booking = GetBL <InventoryBL>().GetBooking(bookingInfo.BookingId); if (booking != null) { booking.IsArchived = checkbox.Checked; GetBL <InventoryBL>().SaveChanges(); } } } LoadBookingData(); } }
void grdExtras_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is Telerik.Web.UI.GridDataItem) { GridViewRow grv = e.Item.DataItem as GridViewRow; Label lblExtraAmount = e.Item.FindControl("lblExtraAmount") as Label; Label lblExtraForeignAmount = e.Item.FindControl("lblExtraForeignAmount") as Label; Telerik.Web.UI.GridDataItem dgi = e.Item as Telerik.Web.UI.GridDataItem; if ((int)((DataRowView)dgi.DataItem)["ExtraTypeId"] == (int)eExtraType.Custom) { Telerik.Web.UI.GridDataItem gdi = e.Item as Telerik.Web.UI.GridDataItem; e.Item.OwnerTableView.Columns[1].Visible = true; } if (lblExtraForeignAmount != null && (((DataRowView)dgi.DataItem)["ForeignAmount"]) != DBNull.Value) { lblExtraForeignAmount.Text = ((decimal)((DataRowView)dgi.DataItem)["ForeignAmount"]).ToString("C", CurrentCulture); } if (lblExtraAmount != null) { lblExtraAmount.Text = ((decimal)((DataRowView)dgi.DataItem)["ExtraAmount"]).ToString("C"); } } }
protected void RadGrid1_DetailTableDataBind(object sender, Telerik.Web.UI.GridDetailTableDataBindEventArgs e) { System.Data.DataSet ds = (System.Data.DataSet)ViewState["DATA.RESULT"]; Telerik.Web.UI.GridDataItem dataItem = (Telerik.Web.UI.GridDataItem)e.DetailTableView.ParentItem; string kdInduk = dataItem.GetDataKeyValue("ID_IKU").ToString(); DataTable dt = ds.Tables[1].Select("ID_IKU = " + kdInduk).CopyToDataTable(); e.DetailTableView.DataSource = dt; }
protected void po_date_end_technicalOfficerRCB_Click(object sender, EventArgs e) { try { CheckBox rcb = (CheckBox)sender; Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)((Control)sender).NamingContainer; string po_id = item.GetDataKeyValue("po_id").ToString(); string user_email = ((Label)item.FindControl("user_emailLBL")).Text; string user_contactPerson = ((Label)item.FindControl("user_contactPersonLBL")).Text; Dictionary <string, string> fields = new Dictionary <string, string>(); Dictionary <string, string> conditions = new Dictionary <string, string>(); conditions.Add("po_id", po_id); if (rcb.Checked == true) { fields.Add("po_date_end_technicalOfficer", DateTime.Now.ToString()); fields.Add("po_isnewforTechmical", false.ToString()); } else { fields.Add("po_date_end_technicalOfficer", DBNull.Value.ToString()); } bool sendedEmail = false; if (rcb.Checked == true) { sendedEmail = SendEmail(user_email, user_contactPerson, 1); } else { sendedEmail = SendEmail(user_email, user_contactPerson, 2); } using (SqlConnection con = new SqlConnection(Controller.connection)) { using (SqlCommand cmd = new SqlCommand()) { con.Open(); if (sendedEmail == true) { Controller.Update(cmd, con, "CNRS_PurchaseOrder", fields, conditions); AlertJS(); RadGridBoxes.Rebind(); } } } } catch (Exception ex) { Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name); } }
protected void RdGrd_ProjectSel_ItemDataBound1(object sender, Telerik.Web.UI.GridItemEventArgs e) { try { Telerik.Web.UI.GridDataItem item = e.Item as Telerik.Web.UI.GridDataItem; GridDataItem griditem = e.Item as GridDataItem; if (item != null) { CheckBox chkTest = (CheckBox)griditem.FindControl("chkJSel"); string strRef = item["Reference"].Text.ToString(); if (strRef == "#Aptmnt") { //item.BackColor = Color.LightGray; item.Cells[7].ForeColor = Color.Blue; chkTest.Enabled = false; chkTest.ToolTip = "Appointments can not able to edit"; } if (!item.Cells[10].Text.Equals(" ")) { if (!item.Cells[8].Text.Equals(" ") && item.Cells[8].Text.Equals("04")) { item.Cells[9].ForeColor = Color.Red; item.Cells[10].ForeColor = Color.Red; item.Cells[9].Font.Bold = true; item.Cells[10].Font.Bold = true; } else if (!item.Cells[8].Text.Equals(" ") && item.Cells[8].Text.Equals("03")) { item.Cells[9].ForeColor = Color.Red; item.Cells[10].ForeColor = Color.Red; item.Cells[9].Font.Bold = true; item.Cells[10].Font.Bold = true; } else if (!item.Cells[8].Text.Equals(" ") && item.Cells[8].Text.Equals("02")) { item.Cells[9].ForeColor = Color.Brown; item.Cells[10].ForeColor = Color.Brown; } } if (item.Cells[14].Text.Equals("Hot") || item.Cells[14].Text.Equals("Very Hot")) { item.Cells[14].ForeColor = Color.Red; } string GetDate = item.Cells[6].Text; string CurrDate = DateTime.Now.ToString("dd/MM/yyyy"); } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }
void GridView1_ItemCommand(object source, GridCommandEventArgs e) { if (e.CommandName == RadGrid.ExpandCollapseCommandName) { Telerik.Web.UI.GridDataItem _griddataitem = e.Item as Telerik.Web.UI.GridDataItem; if (_griddataitem != null) { RadGrid detailedGrid = _griddataitem.ChildItem.FindControl("DetailGridView") as RadGrid; detailedGrid.Rebind(); } } }
void grid_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is Telerik.Web.UI.GridDataItem) { Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item; int parentId = Convert.ToInt32(item.GetDataKeyValue("ParentId")); if (!appliedFilter && parentId > 0) { item.Font.Italic = true; } } }
void gvOrders2_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is Telerik.Web.UI.GridDataItem) { Telerik.Web.UI.GridDataItem gridItem = e.Item as Telerik.Web.UI.GridDataItem; foreach (Telerik.Web.UI.GridColumn column in gvOrders2.Columns) { if (column is Telerik.Web.UI.GridBoundColumn) { gridItem[column.UniqueName].ToolTip = gridItem[column.UniqueName].Text; } } } }
protected void RGSubjectGrid_DeleteCommand(object sender, GridCommandEventArgs e) { AbcDAL MyDAL = new AbcDAL(""); Telerik.Web.UI.GridDataItem MyGridDataItem = e.Item as Telerik.Web.UI.GridDataItem; if (MyGridDataItem != null) { string SubjectID = (string)((GridDataItem)e.Item).GetDataKeyValue("SubjectID"); MyDAL.DeleteSubjectMaster(SubjectID); } MyDAL.BindSubjectComboBox(RCBSubjectName); }
//*** protected void Next_Click(object sender, EventArgs e) { try { LinkButton LBTN = (LinkButton)sender; string po_id = LBTN.CommandArgument; Telerik.Web.UI.GridDataItem dataItem = (Telerik.Web.UI.GridDataItem)((Control)sender).NamingContainer; Label item_id = (Label)dataItem.FindControl("item_idLBL"); NavigateNextStep(item_id.Text, po_id, 1); } catch (Exception ex) { Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name); } }
protected void LnkViewRoles_Click(object sender, EventArgs e) { BindRoles(ChkRolesList); string sLoginID = Convert.ToString(((LinkButton)sender).CommandArgument); TxtHdnLoginID.Text = sLoginID; LinkButton LnkView = ((LinkButton)sender); Telerik.Web.UI.GridDataItem gr = (Telerik.Web.UI.GridDataItem)LnkView.NamingContainer; string fname = (gr.FindControl("LblFirstName") as Label).Text; // string lname = (gr.FindControl("LblLastName") as Label).Text; // LblPopupUserName.Text = "View Roles For : " + Convert.ToString(fname + " " + lname); LblPopupUserName.Text = "View Roles For : " + Convert.ToString(fname); CheckUserRoles(Convert.ToString(sLoginID)); ModalPopupExtender1.Show(); }
protected void po_accept_headOfDepartmentCB_CheckedChanged(object sender, EventArgs e) { CheckBox cb = (CheckBox)sender; Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)((Control)sender).NamingContainer; string po_id = item.GetDataKeyValue("po_id").ToString(); try { using (SqlConnection con = new SqlConnection(Controller.connection)) { using (SqlCommand cmd = new SqlCommand()) { con.Open(); Dictionary <string, string> fields = new Dictionary <string, string>(); fields.Add("po_date_headOfDepartment", DateTime.Now.ToString()); Dictionary <string, string> conditions = new Dictionary <string, string>(); conditions.Add("po_id", po_id); if (cb.Checked == true) { fields.Add("po_accept_headOfDepartment", true.ToString()); fields.Add("po_isnewforHOD", false.ToString()); Controller.Update(cmd, con, "CNRS_PurchaseOrder", fields, conditions); } else { fields.Add("po_accept_headOfDepartment", false.ToString()); Controller.Update(cmd, con, "CNRS_PurchaseOrder", fields, conditions); } AlertJS(); RadGridBoxes.Rebind(); } } } catch (Exception ex) { Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name); } }
void grid_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is Telerik.Web.UI.GridDataItem) { Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item; HyperLink lnkQuickView = (HyperLink)item.FindControl("lnkQuickView"); DropDownList ddOrderStatus = (DropDownList)item.FindControl("ddOrderStatus"); int orderId = Convert.ToInt32(item.GetDataKeyValue("OrderId")); int orderStatus = Convert.ToInt32(item.GetDataKeyValue("OrderStatus")); RadToolTipManager1.TargetControls.Add(lnkQuickView.ClientID, orderId.ToString(), true); PopulateOrderStatus(ddOrderStatus, false); ListItem li = ddOrderStatus.Items.FindByValue(orderStatus.ToString()); if (li != null) { ddOrderStatus.ClearSelection(); li.Selected = true; } } }
public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT); bool result = false; try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", " Debug Submit record method called of ClassRoom", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.ClassRoomService proxySave = new DayCareBAL.ClassRoomService(); DayCarePL.ClassRoomProperties objClassRoom = new DayCarePL.ClassRoomProperties(); Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item; var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem; Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager; if (InsertItem != null) { foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns) { if (column is IGridEditableColumn) { IGridEditableColumn editableCol = (column as IGridEditableColumn); if (editableCol.IsEditable) { IGridColumnEditor editor = editMan.GetColumnEditor(editableCol); switch (column.UniqueName) { case "Name": { objClassRoom.Name = (editor as GridTextBoxColumnEditor).Text.Trim().ToString(); ViewState["Name"] = objClassRoom.Name; break; } case "MaxSize": { if (!string.IsNullOrEmpty((e.Item.FindControl("txtMaxSize") as TextBox).Text)) { objClassRoom.MaxSize = Convert.ToInt32((e.Item.FindControl("txtMaxSize") as TextBox).Text); ViewState["MaxSize"] = objClassRoom.MaxSize; } else { objClassRoom.MaxSize = 0; } break; } case "Active": { objClassRoom.Active = (editor as GridCheckBoxColumnEditor).Value; break; } case "FullName": { objClassRoom.StaffId = new Guid((e.Item.FindControl("ddlStaff") as DropDownList).SelectedValue); break; } } } } } if (Session["SchoolId"] != null) { objClassRoom.SchoolId = new Guid(Session["SchoolId"].ToString()); } if (e.CommandName != "PerformInsert") { if (Session["StaffId"] != null) { objClassRoom.LastModifiedById = new Guid(Session["StaffId"].ToString()); } objClassRoom.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString()); // objClassRoom.StaffId = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["FullName"].ToString()); if (!objClassRoom.Id.ToString().Equals(hdnName.Value.Trim())) { // bool ans = Common.CheckDuplicate("ClassRoom", "Name", objClassRoom.Name, "update", objClassRoom.Id.ToString()); bool ans = proxySave.CheckDuplicateClassRoomName(objClassRoom.Name, objClassRoom.Id, objClassRoom.SchoolId, objClassRoom.StaffId.Value, new Guid(Session["CurrentSchoolYearId"].ToString())); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } } else { // bool ans = Common.CheckDuplicate("ClassRoom", "Name", objClassRoom.Name, "insert", objClassRoom.Id.ToString()); bool ans = proxySave.CheckDuplicateClassRoomName(objClassRoom.Name, objClassRoom.Id, objClassRoom.SchoolId, objClassRoom.StaffId.Value, new Guid(Session["CurrentSchoolYearId"].ToString())); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } hdnName.Value = ""; //result = proxySave.Save(objClassRoom); if (Session["StaffId"] == null) { Response.Redirect("~/Login.aspx"); } else { objClassRoom.LastModifiedById = new Guid(Session["StaffId"].ToString()); } result = proxySave.SaveClassRoomYearWise(objClassRoom, new Guid(Session["CurrentSchoolYearId"].ToString())); if (result == true) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); } } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); result = false; } return(result); }
public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clUserGroup, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT); bool result = false; try { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clUserGroup, "SubmitRecord", "Debug Submit record method called of UserGroup", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.UserGroupService proxySave = new DayCareBAL.UserGroupService(); DayCarePL.UserGroupProperties objUserGroup = new DayCarePL.UserGroupProperties(); Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item; var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem; Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager; if (InsertItem != null) { foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns) { if (column is IGridEditableColumn) { IGridEditableColumn editableCol = (column as IGridEditableColumn); if (editableCol.IsEditable) { IGridColumnEditor editor = editMan.GetColumnEditor(editableCol); switch (column.UniqueName) { case "GroupTitle": { objUserGroup.GroupTitle = (e.Item.FindControl("txtGroupTitle") as TextBox).Text; ViewState["GroupTitle"] = objUserGroup.GroupTitle; break; } case "Role": { objUserGroup.RoleId = new Guid((e.Item.FindControl("ddlRole") as DropDownList).SelectedValue); ViewState["RoleName"] = objUserGroup.RoleId; break; } case "Comments": { objUserGroup.Comments = (e.Item.FindControl("txtComments") as TextBox).Text; ViewState["Comments"] = objUserGroup.Comments; break; } } } } } if (Session["SchoolId"] != null) { objUserGroup.SchoolId = new Guid(Session["SchoolId"].ToString()); } if (e.CommandName != "PerformInsert") { if (Session["StaffId"] != null) { objUserGroup.LastModifiedById = new Guid(Session["StaffId"].ToString()); } objUserGroup.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString()); if (!objUserGroup.GroupTitle.Trim().Equals(hdnName.Value.Trim())) { bool ans = proxySave.CheckDuplicateUserGroupTitle(objUserGroup.GroupTitle, objUserGroup.Id, objUserGroup.SchoolId); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } } else { bool ans = proxySave.CheckDuplicateUserGroupTitle(objUserGroup.GroupTitle, objUserGroup.Id, objUserGroup.SchoolId); //bool ans = Common.CheckDuplicate("UserGroup", "Group Title", objUserGroup.GroupTitle, "insert", objUserGroup.Id.ToString()); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } hdnName.Value = ""; result = proxySave.Save(objUserGroup); if (result == true) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); } } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.UserGroup, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); result = false; } return(result); }
public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ChargeCode, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT); bool result = false; try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ChargeCode, "SubmitRecord", " Debug Submit record method called of ChargeCode", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.ChargeCodeService proxySave = new DayCareBAL.ChargeCodeService(); DayCarePL.ChargeCodeProperties objChargeCode = new DayCarePL.ChargeCodeProperties(); Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item; var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem; Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager; if (InsertItem != null) { foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns) { if (column is IGridEditableColumn) { IGridEditableColumn editableCol = (column as IGridEditableColumn); if (editableCol.IsEditable) { IGridColumnEditor editor = editMan.GetColumnEditor(editableCol); switch (column.UniqueName) { case "Name": { objChargeCode.Name = (item["Name"].Controls[1] as TextBox).Text; ViewState["Name"] = objChargeCode.Name; break; } case "Category": { objChargeCode.Category = (e.Item.FindControl("ddlCategory") as DropDownList).SelectedValue.Trim().ToString(); ViewState["Category"] = objChargeCode.Category; break; } case "Debit": { if ((e.Item.FindControl("rbDebit") as RadioButton).Checked == true) { objChargeCode.DebitCrdit = (e.Item.FindControl("rbDebit") as RadioButton).Checked; } break; } } } } } if (e.CommandName != "PerformInsert") { if (Session["StaffId"] != null) { objChargeCode.LastModifiedById = new Guid(Session["StaffId"].ToString()); objChargeCode.CreatedById = new Guid(Session["StaffId"].ToString()); } objChargeCode.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString()); if (!objChargeCode.Name.Trim().Equals(hdnName.Value.Trim())) { bool ans = Common.CheckDuplicate("ChargeCode", "Name", objChargeCode.Name, "update", objChargeCode.Id.ToString()); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } } else { if (Session["StaffId"] != null) { objChargeCode.LastModifiedById = new Guid(Session["StaffId"].ToString()); objChargeCode.CreatedById = new Guid(Session["StaffId"].ToString()); } bool ans = Common.CheckDuplicate("ChargeCode", "Name", objChargeCode.Name, "insert", objChargeCode.Id.ToString()); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } hdnName.Value = ""; result = proxySave.Save(objChargeCode); if (result == true) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); } } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.ChargeCode, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); } return(result); }
public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clAbsentReason, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT); bool result = false; try { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clAbsentReason, "SubmitRecord", "Debug Submit record method called of AbsentReason", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.StaffAttendanceHistoryListService proxySave = new DayCareBAL.StaffAttendanceHistoryListService(); DayCarePL.StaffAttendenceHistoryProperties objStaffAttendance = new DayCarePL.StaffAttendenceHistoryProperties(); Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item; var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem; Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager; if (InsertItem != null) { foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns) { if (column is IGridEditableColumn) { IGridEditableColumn editableCol = (column as IGridEditableColumn); if (editableCol.IsEditable) { IGridColumnEditor editor = editMan.GetColumnEditor(editableCol); switch (column.UniqueName) { case "CheckInCheckOutDateTime": { objStaffAttendance.CheckInCheckOutDateTime = Convert.ToDateTime((e.Item.FindControl("rdpCheckInCheckOutDateTime") as RadDatePicker).SelectedDate); break; } case "CheckInTime": { if ((e.Item.FindControl("rtpCheckInTime") as RadTimePicker).SelectedDate != null) { objStaffAttendance.CheckInTime = Convert.ToDateTime((e.Item.FindControl("rtpCheckInTime") as RadTimePicker).SelectedDate); } break; } case "CheckOutTime": { if ((e.Item.FindControl("rtpCheckOutTime") as RadTimePicker).SelectedDate != null) { objStaffAttendance.CheckOutTime = Convert.ToDateTime((e.Item.FindControl("rtpCheckOutTime") as RadTimePicker).SelectedDate); } break; } //case "StaffSchoolYearId": // { // objStaffAttendance.StaffSchoolYearId = new Guid((editor as GridTextBoxColumnEditor).Text.Trim()); // break; // } } } } } if (objStaffAttendance.CheckInTime != null) { objStaffAttendance.CheckInCheckOutDateTime = objStaffAttendance.CheckInCheckOutDateTime + objStaffAttendance.CheckInTime.Value.TimeOfDay; objStaffAttendance.CheckInCheckOut = true; } if (objStaffAttendance.CheckOutTime != null) { objStaffAttendance.CheckInCheckOutDateTime = objStaffAttendance.CheckInCheckOutDateTime + objStaffAttendance.CheckOutTime.Value.TimeOfDay; objStaffAttendance.CheckInCheckOut = false; } if (objStaffAttendance.CheckInTime == null && objStaffAttendance.CheckOutTime == null) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please select check in or check out time", "false")); result = false; } else if (objStaffAttendance.CheckInTime != null && objStaffAttendance.CheckOutTime != null) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please select check in or check out time", "false")); result = false; } else { if (ViewState["StaffSchoolYearId"] != null) { objStaffAttendance.StaffSchoolYearId = new Guid(ViewState["StaffSchoolYearId"].ToString()); } if (e.CommandName != "PerformInsert") { objStaffAttendance.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString()); } if (proxySave.Save(objStaffAttendance)) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); result = true; } } } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.AbsentReason, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); result = false; } return(result); }
public bool SubmitRecord(object source, GridCommandEventArgs e) { bool result = false; try { DayCareBAL.StateService proxyState = new DayCareBAL.StateService(); DayCarePL.StateProperties objState = new DayCarePL.StateProperties(); Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item; var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem; Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager; if (InsertItem != null) { foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns) { if (column is IGridEditableColumn) { IGridEditableColumn editableCol = (column as IGridEditableColumn); if (editableCol.IsEditable) { IGridColumnEditor editor = editMan.GetColumnEditor(editableCol); switch (column.UniqueName) { case "Name": { objState.Name = (item["Name"].Controls[1] as TextBox).Text; break; } case "CountryName": { objState.CountryId = new Guid((e.Item.FindControl("ddlCountry") as DropDownList).SelectedValue); break; } } } } } if (e.CommandName != "PerformInsert") { objState.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString()); if (!objState.Name.Trim().Equals(hdnName.Value.Trim())) { bool ans = Common.CheckDuplicate("State", "Name", objState.Name, "update", objState.Id.ToString()); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } } else { bool ans = Common.CheckDuplicate("State", "Name", objState.Name, "insert", ""); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } hdnName.Value = ""; result = proxyState.Save(objState); if (result) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); } } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.State, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); result = false; } return(result); }
public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.EnrollmentStatus, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT); bool result = false; try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.EnrollmentStatus, "SubmitRecord", " Debug Submit record method called of Enrollmentstatus", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.EnrollmentStausService proxySave = new DayCareBAL.EnrollmentStausService(); DayCarePL.EnrollmentStatusProperties objEnrollment = new DayCarePL.EnrollmentStatusProperties(); Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item; var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem; Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager; if (InsertItem != null) { foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns) { if (column is IGridEditableColumn) { IGridEditableColumn editableCol = (column as IGridEditableColumn); if (editableCol.IsEditable) { IGridColumnEditor editor = editMan.GetColumnEditor(editableCol); switch (column.UniqueName) { case "Status": { objEnrollment.Status = (editor as GridTextBoxColumnEditor).Text.Trim().ToString(); ViewState["Staus"] = objEnrollment.Status; break; } case "Active": { objEnrollment.Active = (editor as GridCheckBoxColumnEditor).Value; break; } case "Comments": { objEnrollment.Comments = (e.Item.FindControl("txtComments") as TextBox).Text.Trim().ToString(); ViewState["Comments"] = objEnrollment.Comments; break; } } } } } if (Session["SchoolId"] != null) { objEnrollment.SchoolId = new Guid(Session["SchoolId"].ToString()); } if (e.CommandName != "PerformInsert") { objEnrollment.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString()); if (!objEnrollment.Id.ToString().Equals(hdnName.Value.Trim())) { bool ans = proxySave.CheckDuplicateEnrollmentStatusName(objEnrollment.Status, objEnrollment.Id, objEnrollment.SchoolId); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } } else { bool ans = proxySave.CheckDuplicateEnrollmentStatusName(objEnrollment.Status, objEnrollment.Id, objEnrollment.SchoolId); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } hdnName.Value = ""; result = proxySave.Save(objEnrollment); if (result == true) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); } } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.EnrollmentStatus, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); result = false; } return(result); }
public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.Font, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT); bool result = false; string FontSize = ""; try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.Font, "SubmitRecord", " Debug Submit record method called of Font", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.FontService proxySave = new DayCareBAL.FontService(); DayCarePL.FontProperties objFont = new DayCarePL.FontProperties(); Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item; var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem; Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager; if (InsertItem != null) { foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns) { if (column is IGridEditableColumn) { IGridEditableColumn editableCol = (column as IGridEditableColumn); if (editableCol.IsEditable) { IGridColumnEditor editor = editMan.GetColumnEditor(editableCol); switch (column.UniqueName) { case "Name": { objFont.Name = (editor as GridTextBoxColumnEditor).Text.Trim().ToString(); ViewState["Name"] = objFont.Name; break; } case "Color": { //objFont.Color=(e.Item.FindControl("rcpColor") as RadColorPicker ). if ((e.Item.FindControl("rcpColor") as RadColorPicker) != null && (e.Item.FindControl("rcpColor") as RadColorPicker).SelectedColor.Name != "0") { objFont.Color = "#" + (e.Item.FindControl("rcpColor") as RadColorPicker).SelectedColor.Name; } break; } case "Size": { FontSize = (e.Item.FindControl("txtSize") as TextBox).Text.Trim(); //objFont.Size = Convert.ToInt32((e.Item.FindControl("txtSize") as TextBox).Text.Trim()); ViewState["Size"] = objFont.Size; break; } case "Active": { objFont.Active = (editor as GridCheckBoxColumnEditor).Value; break; } } } } } int res = 0; Int32.TryParse(FontSize, out res); if (res == 0) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Font size must be numeric.", "false")); return(false); } else { objFont.Size = Convert.ToInt32(FontSize); } if (string.IsNullOrEmpty(objFont.Color)) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please select color.", "false")); return(false); } if (e.CommandName != "PerformInsert") { //objFont.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString()); objFont.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString()); if (!objFont.Name.Trim().Equals(hdnName.Value.Trim())) { bool ans = Common.CheckDuplicate("Font", "Name", objFont.Name, "update", objFont.Id.ToString()); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } } else { bool ans = Common.CheckDuplicate("Font", "Name", objFont.Name, "insert", objFont.Id.ToString()); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } hdnName.Value = ""; result = proxySave.Save(objFont); if (result == true) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); } } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Font, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); result = false; } return(result); }