Exemplo n.º 1
0
 public static void BindFeesPeriod(DropDownList ddlFeesPeriod)
 {
     try
     {
         DayCareBAL.FeesPeriodService     proxyClassRoom = new DayCareBAL.FeesPeriodService();
         DayCarePL.FeesPeriodProperties[] FeesPeriod     = proxyClassRoom.LoadFeesPeriod();
         if (FeesPeriod != null && FeesPeriod.Count() > 0)
         {
             ddlFeesPeriod.DataSource     = FeesPeriod.ToList().FindAll(c => c.Active.Equals(true));
             ddlFeesPeriod.DataTextField  = "Name";
             ddlFeesPeriod.DataValueField = "Id";
             ddlFeesPeriod.DataBind();
             ddlFeesPeriod.Items.Insert(0, new ListItem("--Select--", DayCarePL.Common.GUID_DEFAULT));
         }
     }
     catch
     {
     }
 }
Exemplo n.º 2
0
 protected void rgFeesPeriod_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
 {
     DayCareBAL.FeesPeriodService proxyLoad = new DayCareBAL.FeesPeriodService();
     rgFeesPeriod.DataSource = proxyLoad.LoadFeesPeriod();
 }
Exemplo n.º 3
0
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.FeesPeriod, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.FeesPeriod, "SubmitRecord", "Debug Submit Record Of FeesPeriod", DayCarePL.Common.GUID_DEFAULT);

                DayCareBAL.FeesPeriodService   proxySave     = new DayCareBAL.FeesPeriodService();
                DayCarePL.FeesPeriodProperties objFeesPeriod = new DayCarePL.FeesPeriodProperties();

                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":
                                {
                                    objFeesPeriod.Name = (editor as GridTextBoxColumnEditor).Text.Trim().ToString();
                                    ViewState["Name"]  = objFeesPeriod.Name;
                                    break;
                                }

                                case "Active":
                                {
                                    objFeesPeriod.Active = (editor as GridCheckBoxColumnEditor).Value;
                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        if (Session["StaffId"] != null)
                        {
                            objFeesPeriod.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                        objFeesPeriod.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        if (!objFeesPeriod.Name.Trim().Equals(hdnName.Value.Trim()))
                        {
                            bool ans = Common.CheckDuplicate("FeesPeriod", "Name", objFeesPeriod.Name, "update", objFeesPeriod.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("FeesPeriod", "Name", objFeesPeriod.Name, "insert", objFeesPeriod.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(objFeesPeriod);
                    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.FeesPeriod, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }