示例#1
0
 public static Common.ServiceGroup LoadServiceGroup(Guid ServiceGroupGuid)
 {
     Business.ServiceGroup serviceGroupController = new Business.ServiceGroup();
     Common.ServiceGroup   serviceGroup           = new Common.ServiceGroup();
     serviceGroupController.Load(ServiceGroupGuid, serviceGroup);
     return(serviceGroup);
 }
示例#2
0
        private void InitializePage()
        {
            int rowCount = 0;

            drpMasterGroup.DataSource     = Facade.ServiceGroup.GetPagedServiceGroup(string.Empty, "[CreateDate]", 0, 0, ref rowCount);
            drpMasterGroup.DataTextField  = "Title";
            drpMasterGroup.DataValueField = "Guid";
            drpMasterGroup.DataBind();
            drpMasterGroup.Items.Insert(0, new ListItem(string.Empty, Guid.Empty.ToString()));

            if (ActionType == "edit")
            {
                Common.ServiceGroup serviceGroup = new Common.ServiceGroup();
                serviceGroup                 = Facade.ServiceGroup.LoadServiceGroup(ServiceGroupGuid);
                txtTitle.Text                = serviceGroup.Title;
                txtOrder.Text                = serviceGroup.Order.ToString();
                hdnIcon.Value                = serviceGroup.IconAddress;
                hdnLargeIcon.Value           = serviceGroup.LargeIcon;
                drpMasterGroup.SelectedValue = Helper.GetGuid(serviceGroup.parentGuid).ToString();
            }

            btnSave.Text = Language.GetString(btnSave.Text);
            btnSave.Attributes["onclick"] = "return validateRequiredFields('AddServiceGroup');";
            btnCancel.Text = Language.GetString(btnCancel.Text);
        }
        public DataTable gridServiceGroup_OnDataBind(string sortField, string searchFiletrs, string toolbarFilters, string userData, int pageNo, int pageSize, ref int resultCount, ref string customData)
        {
            Common.ServiceGroup serviceGroup = new Common.ServiceGroup();

            string title = Helper.ImportData(searchFiletrs, "Title");

            return(Facade.ServiceGroup.GetPagedServiceGroup(title, sortField, pageNo, pageSize, ref resultCount));
        }
示例#4
0
 public bool UpdateServiceGroup(Common.ServiceGroup serviceGroup)
 {
     return(base.ExecuteSPCommand("UpdateServiceGroup", "@Guid", serviceGroup.ServiceGroupGuid,
                                  "@Title", serviceGroup.Title,
                                  "@IconAddress", serviceGroup.IconAddress,
                                  "@LargeIcon", serviceGroup.LargeIcon,
                                  "@ParentGuid", serviceGroup.parentGuid,
                                  "@Order", serviceGroup.Order));
 }
示例#5
0
 public static bool UpdateServiceGroup(Common.ServiceGroup serviceGroup)
 {
     Business.ServiceGroup serviceGroupController = new Business.ServiceGroup();
     return(serviceGroupController.UpdateServiceGroup(serviceGroup));
 }
示例#6
0
 public static bool Insert(Common.ServiceGroup serviceGroup)
 {
     Business.ServiceGroup serviceGroupController = new Business.ServiceGroup();
     return(serviceGroupController.Insert(serviceGroup) != Guid.Empty ? true : false);
 }
示例#7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Common.ServiceGroup serviceGroup = new Common.ServiceGroup();
            string        uploadTarget       = Server.MapPath("~/Images/");
            List <string> lstValidExtention  = new List <string>();

            lstValidExtention.Add(".jpg");
            lstValidExtention.Add(".jpeg");
            lstValidExtention.Add(".png");
            lstValidExtention.Add(".gif");
            lstValidExtention.Add(".bmp");

            try
            {
                serviceGroup.ServiceGroupGuid = ServiceGroupGuid;
                serviceGroup.Title            = txtTitle.Text;
                serviceGroup.Order            = Helper.GetInt(txtOrder.Text);
                serviceGroup.parentGuid       = Helper.GetGuid(drpMasterGroup.SelectedValue);
                serviceGroup.IconAddress      = hdnIcon.Value;
                serviceGroup.LargeIcon        = hdnLargeIcon.Value;
                serviceGroup.CreateDate       = DateTime.Now;

                if (uploadIcon.HasFile)
                {
                    string fileExtention = Path.GetExtension(uploadIcon.PostedFile.FileName).ToLower();
                    if (!lstValidExtention.Contains(fileExtention))
                    {
                        throw new Exception((Language.GetString("InvalidFileExtension")));
                    }

                    string iconPic = Guid.NewGuid().ToString() + fileExtention;
                    uploadIcon.SaveAs(uploadTarget + iconPic);
                    serviceGroup.IconAddress = "Images/" + iconPic;
                }

                if (uploadLargeIcon.HasFile)
                {
                    string fileExtention = Path.GetExtension(uploadLargeIcon.PostedFile.FileName).ToLower();
                    if (!lstValidExtention.Contains(fileExtention))
                    {
                        throw new Exception((Language.GetString("InvalidFileExtension")));
                    }

                    string largeIconPic = Guid.NewGuid().ToString() + fileExtention;
                    uploadLargeIcon.SaveAs(uploadTarget + largeIconPic);
                    serviceGroup.LargeIcon = "Images/" + largeIconPic;
                }

                if (serviceGroup.HasError)
                {
                    throw new Exception(serviceGroup.ErrorMessage);
                }

                switch (ActionType)
                {
                case "edit":
                    if (!Facade.ServiceGroup.UpdateServiceGroup(serviceGroup))
                    {
                        throw new Exception(Language.GetString("ErrorRecord"));
                    }

                    break;

                case "insert":
                    if (!Facade.ServiceGroup.Insert(serviceGroup))
                    {
                        throw new Exception(Language.GetString("ErrorRecord"));
                    }
                    break;
                }

                ltrResult.Text = string.Format("<div class='bg-success div-save-result'><span class='fa fa-check fa-2x green'></span>{0}</div>", Language.GetString("InsertRecord"));
            }
            catch (Exception ex)
            {
                ltrResult.Text = string.Format("<div class='bg-danger div-save-result'><span class='fa fa-times fa-2x red'></span>{0}</div>", ex.Message);
            }
        }