コード例 #1
0
        private static ComponentArt.Web.UI.MenuItem LoadCmdsubItem(DirectoryInfo dir, DirectoryInfo subdir, FileInfo finfo)
        {
            ComponentArt.Web.UI.MenuItem retVal = new ComponentArt.Web.UI.MenuItem();
            retVal.Text = finfo.Name;
            //			string domain = Request.Url.Host;
            //			string port = Request.Url.Port.ToString();
            string redirect = "";

            //			if(domain.LastIndexOf(".")<=0)
            redirect = "/Temp/" + dir.Parent.Name + "/" + subdir.Parent.Name + "/" + subdir.Name + "/" + finfo.Name;
            //			else
            //				redirect = "http://" + domain + "/Temp/"+ dir.Parent.Name + "/" + subdir.Parent.Name + "/"+subdir.Name+"/"+finfo.Name;
            retVal.NavigateUrl = MiscUtility.UpdateQueryStringItem(HttpContext.Current.Request, "url", redirect);
            return(retVal);
        }
コード例 #2
0
        string GetPumpStatus(ST_Motor motor)
        {
            string result = UNKNOW;

            if (MiscUtility.GetBool(motor.member, PLCConstants.POS_DEVICE_FEEDBACK))
            {
                result = OPENED;
            }
            else
            {
                result = CLOSED;
            }

            return(result);
        }
コード例 #3
0
        private static DataTable LoadKeHoachCongViecForCur(DataTable dtCongViec, DataRow curItem, DataTable dtReturnCongViec)
        {
            int level = Convert.ToInt32(curItem["Level"]);

            level += 1;
            int ID = Convert.ToInt32(curItem["ID"]);

            DataRow[] dtChild = GetCongViecByParentID(dtCongViec, ID);
            foreach (DataRow row in dtChild)
            {
                DataRow childItem = dtReturnCongViec.NewRow();
                childItem["CreateBy"]      = row["CreateBy"].ToString();
                childItem["CongViecKPI"]   = row["CongViecKPI"].ToString();
                childItem["CongViecCha"]   = row["CongViecCha"].ToString();
                childItem["TyTrong"]       = row["TyTrong"].ToString();
                childItem["SoGio"]         = row["SoGio"].ToString();
                childItem["TyLeHoanThanh"] = row["TyLeHoanThanh"].ToString();
                childItem["KetQua"]        = row["KetQua"].ToString();
                childItem["LyDo"]          = row["LyDo"].ToString();
                childItem["DeXuat"]        = row["DeXuat"].ToString();
                childItem["Level"]         = level;
                childItem["ID"]            = row["ID"].ToString();
                childItem["IDTrungTam"]    = row["IDTrungTam"].ToString();
                childItem["IDPhongBan"]    = row["IDPhongBan"].ToString();
                childItem["ParentID"]      = row["ParentID"].ToString();

                if (level == 1)
                {
                    childItem["Ten"] = MiscUtility.StringIndent(level) + "<font color=\"Black\">" + row["Ten"].ToString() + "</font>";
                }
                else if (level == 2)
                {
                    childItem["Ten"] = MiscUtility.StringIndent(level) + "<font color=\"Orange\">" + row["Ten"].ToString() + "</font>";
                }
                else if (level == 3)
                {
                    childItem["Ten"] = MiscUtility.StringIndent(level) + "<font color=\"Orange\">" + row["Ten"].ToString() + "</font>";
                }
                else if (level > 3)
                {
                    childItem["Ten"] = MiscUtility.StringIndent(level) + "<font color=\"Gray\">" + row["Ten"].ToString() + "</font>";
                }

                dtReturnCongViec.Rows.Add(childItem);
                LoadKeHoachCongViecForCur(dtCongViec, childItem, dtReturnCongViec);
            }
            return(dtReturnCongViec);
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblUpdateStatus.Text = string.Empty;
            if (!CurrentUser.IsSuperAdmin)
            {
                Response.Redirect(AppEnv.ADMIN_CMD);
            }
            if (!Page.IsPostBack)
            {
                MiscUtility.FillIndex(dropIndex, 30, 1);
                DataTable dtPortalByLang = null;

                dgrNameFollowLang.DataSource = builddata(dtPortalByLang);
                dgrNameFollowLang.DataBind();
            }
        }
コード例 #5
0
        public static void LoadForCurItemForRadCombo(ListItemCollection lstItems, ListItem curItem, int userId)
        {
            int curId = ConvertUtility.ToInt32(curItem.Value);
            int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]);

            level++;
            DataTable dtChildZones = GetPortalsByParentId(userId, curId);

            foreach (DataRow row in dtChildZones.Rows)
            {
                ListItem item = new ListItem(MiscUtility.StringIndent(level) + row["Portal_Name"].ToString(), row["PortalID"].ToString());
                item.Attributes.Add("Level", level.ToString());
                lstItems.Add(item);
                LoadForCurItemForRadCombo(lstItems, item, userId);
            }
        }
コード例 #6
0
        public static void LoadForCurItem(ListItemCollection lstItems, ListItem curItem)
        {
            int curId = ConvertUtility.ToInt32(curItem.Value);
            int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]);

            level++;
            DataTable dtChildRoles = GetRolesByParentId(curId);

            foreach (DataRow row in dtChildRoles.Rows)
            {
                ListItem item = new ListItem(MiscUtility.StringIndent(level) + row["RoleName"].ToString(), row["RoleID"].ToString());
                item.Attributes.Add("Level", level.ToString());
                lstItems.Add(item);
                LoadForCurItem(lstItems, item);
            }
        }
コード例 #7
0
        private void LoadZones()
        {
            ZoneUtility.LoadZones(lstZones.Items);
            lstZones.Items.Insert(0, new ListItem("Root", "0"));

            dropZones.Items.Clear();
            foreach (ListItem item in lstZones.Items)
            {
                dropZones.Items.Add(new ListItem(item.Text, item.Value));
            }


            MiscUtility.SetSelected(lstZones.Items, zoneSelected.ToString());

            lstZones_SelectedIndexChanged(null, null);
        }
コード例 #8
0
        protected void dtgAdvertises_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemIndex < 0)
            {
                return;
            }
            DataRowView curData   = (DataRowView)e.Item.DataItem;
            string      locations = "|" + curData["Advertise_Params"];
            //string strLocation = string.Empty;
            //foreach (ListItem item in lstZones.Items)
            //{
            //    if (locations.IndexOf("|" + item.Value + "|") >= 0)
            //        strLocation += item.Text + "<br>";
            //}
            //e.Item.Cells[2].Text = strLocation;

            Literal litUrl = (Literal)e.Item.FindControl("litUrl");

            switch (curData["Advertise_Type"].ToString())
            {
            case "flash":
                litUrl.Text = MultimediaUtility.strInitFlash(curData["Advertise_Path"].ToString(), Convert.ToInt32(curData["Advertise_Width"]), Convert.ToInt32(curData["Advertise_Height"]));
                break;

            case "media":
                litUrl.Text = MultimediaUtility.strInitMultimedia(curData["Advertise_Path"].ToString(), Convert.ToInt32(curData["Advertise_Width"]), Convert.ToInt32(curData["Advertise_Height"]));
                break;

            case "other":
                litUrl.Text = curData["Advertise_Path"].ToString();
                break;

            case "image":
                if (curData["Advertise_Path"].ToString() != string.Empty)
                {
                    litUrl.Text = "<img src='" + curData["Advertise_Path"] + "' width='120'></img>";
                }
                break;
            }
            litUrl.Text += "<br><a href='" + curData["Advertise_RedirectURL"] + "'>" + curData["Advertise_Name"] + "</a>";
            Button cmdDel = (Button)e.Item.FindControl("cmdDel");

            cmdDel.Attributes.Add("onclick", MiscUtility.DELETE_CONFIRM);
            DropDownList dropPriority = (DropDownList)e.Item.FindControl("dropPriority");

            MiscUtility.FillIndex(dropPriority, 0, 20, ConvertUtility.ToInt32(curData["Advertise_Priority"]));
        }
コード例 #9
0
        public void OpeningSplash()
        {
            MiscUtility.PlaySound("Sounds\\LOZ_Fanfare.wav");
            using (StreamReader sr = new StreamReader("SplashArt.txt"))
            {
                while (!sr.EndOfStream)
                {
                    Console.WriteLine(sr.ReadLine());
                }
            }
            Console.WriteLine("\nAn Umbrella Corporation Creation\n\n\n\n\n\n");

            ResidentEvil();

            PressAnyToContinue();
            MainMenu();
        }
コード例 #10
0
        /// <summary>
        /// Load role permission for current item
        /// </summary>
        /// <param name="dtCommand"></param>
        /// <param name="curItem"></param>
        /// <param name="dtReturnCommand"></param>
        /// <returns></returns>
        public static DataTable LoadRolePermissionForCur(DataTable dtCommand, DataRow curItem, DataTable dtReturnCommand)
        {
            int level = Convert.ToInt32(curItem["Level"]);

            level += 1;
            int _commandID = Convert.ToInt32(curItem["CommandID"]);

            DataRow[] dtChild = GetRolePermissionByParentID(dtCommand, _commandID);
            foreach (DataRow row in dtChild)
            {
                DataRow childItem = dtReturnCommand.NewRow();
                childItem["CommandID"]       = row["CommandID"].ToString();
                childItem["CommandParentID"] = row["CommandParentID"].ToString();
                childItem["PortalID"]        = row["PortalID"].ToString();
                childItem["RoleID"]          = row["RoleID"].ToString();
                if (level == 1)
                {
                    childItem["CommandName"] = MiscUtility.StringIndent(level) + "<font color=\"Red\">" + row["CommandName"].ToString() + "</font>";
                }
                else if (level == 2)
                {
                    childItem["CommandName"] = MiscUtility.StringIndent(level) + "<font color=\"Orange\">" + row["CommandName"].ToString() + "</font>";
                }
                else if (level == 3)
                {
                    childItem["CommandName"] = MiscUtility.StringIndent(level) + "<font color=\"Black\">" + row["CommandName"].ToString() + "</font>";
                }
                else if (level > 3)
                {
                    childItem["CommandName"] = MiscUtility.StringIndent(level) + "<font color=\"Gray\">" + row["CommandName"].ToString() + "</font>";
                }
                childItem["Role_View"]   = row["Role_View"].ToString();
                childItem["Role_Add"]    = row["Role_Add"].ToString();
                childItem["Role_Update"] = row["Role_Update"].ToString();
                childItem["Role_Delete"] = row["Role_Delete"].ToString();
                //childItem["UseForWeb"] = row["UseForWeb"].ToString();
                //childItem["UseForWap"] = row["UseForWap"].ToString();
                //childItem["UseForSMS"] = row["UseForSMS"].ToString();
                //childItem["UseForXzone"] = row["UseForXzone"].ToString();
                childItem["Level"] = level.ToString();

                dtReturnCommand.Rows.Add(childItem);
                LoadRolePermissionForCur(dtCommand, childItem, dtReturnCommand);
            }
            return(dtReturnCommand);
        }
コード例 #11
0
        private Dictionary <string, string> ProcessDelete(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(MiscUtility.GetErrorMsg("No id"));
            }
            else
            {
                Guid imageID = new Guid(id);
                var  item    = service.FindOne(imageID);

                if (item == null)
                {
                    return(MiscUtility.GetErrorMsg("data not found"));
                }

                try
                {
                    service.Delete(imageID);

                    if (!string.IsNullOrWhiteSpace(item.OriginalImage))
                    {
                        string fileName1 = Server.MapPath(string.Format("~/{0}/{1}", OriginalFolder, item.OriginalImage));
                        if (System.IO.File.Exists(fileName1))
                        {
                            System.IO.File.Delete(fileName1);
                        }
                    }

                    if (!string.IsNullOrWhiteSpace(item.CropImage))
                    {
                        string fileName2 = Server.MapPath(string.Format("~/{0}/{1}", CropFolder, item.CropImage));
                        if (System.IO.File.Exists(fileName2))
                        {
                            System.IO.File.Delete(fileName2);
                        }
                    }

                    return(MiscUtility.GetSuccess());
                }
                catch (Exception ex)
                {
                    return(MiscUtility.GetExceptionMsg(ex.Message));
                }
            }
        }
コード例 #12
0
ファイル: CmdDB.cs プロジェクト: coltechvn/SolArt
        private static void LoadCmdItem(ListItemCollection lstCmds, ListItem curItem)
        {
            int level = Convert.ToInt32(curItem.Attributes["Level"]);

            level += 1;
            int       curID   = Convert.ToInt32(curItem.Value);
            DataTable dtChild = GetByParentID(curID);

            foreach (DataRow row in dtChild.Rows)
            {
                ListItem childItem = new ListItem();
                childItem.Text  = MiscUtility.StringIndent(level) + row["Cmd_Name"].ToString();
                childItem.Value = row["Cmd_ID"].ToString();
                childItem.Attributes.Add("Level", level.ToString());
                lstCmds.Add(childItem);
                LoadCmdItem(lstCmds, childItem);
            }
        }
コード例 #13
0
        private void BuildCongViec()
        {
            dropCongViecKPI.Items.Clear();
            DataTable dtCongViec = DotDanhGiaController.GetAllCongViecGiaoChoNhanVienTheoNgay(CurrentUser.UserID, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));

            DataTable dtCongViecClone = dtCongViec.Clone();

            foreach (DataRow item in dtCongViec.Rows)
            {
                DataTable lstCongViec = new DataTable();
                lstCongViec.Columns.Add("IDCongViecKPI", typeof(string));
                lstCongViec.Columns.Add("Ten", typeof(string));
                lstCongViec.Columns.Add("ParentID", typeof(string));
                lstCongViec.Columns.Add("LevelDeep", typeof(string));
                GetTenCongViec(lstCongViec, ConvertUtility.ToInt32(item["IDCongViecKPI"]), ConvertUtility.ToString(item["Ten"]), ConvertUtility.ToInt32(item["ParentID"]), ConvertUtility.ToInt32(item["LevelDeep"]));

                lstCongViec = resort(lstCongViec, "LevelDeep", "DESC");
                int i = 0;
                foreach (DataRow _item in lstCongViec.Rows)
                {
                    DataRow row = dtCongViecClone.NewRow();

                    row["IDCongViecKPI"] = item["IDCongViecKPI"];
                    row["Ten"]           = MiscUtility.StringIndent(i) + _item["Ten"];

                    ListItem itemStyle = new ListItem();
                    itemStyle.Text  = MiscUtility.StringIndent(i) + _item["Ten"];
                    itemStyle.Value = item["IDCongViecKPI"].ToString();
                    if (i == lstCongViec.Rows.Count - 1)
                    {
                        itemStyle.Attributes.Add("style", "font-weight:bold; color:blue");
                    }
                    else
                    {
                        itemStyle.Attributes.Add("style", "font-style: italic;");
                    }

                    dropCongViecKPI.Items.Add(itemStyle);
                    i++;
                }
            }

            dropCongViecKPI.Items.Add(new ListItem("Công việc khác hoặc công việc phát sinh", "0"));
        }
コード例 #14
0
        string GetValveStatus(ST_Valve valve)
        {
            string result = UNKNOW;

            if (MiscUtility.GetBool(valve.member, PLCConstants.POS_VALVE_OPENED))
            {
                result = OPENED;
            }
            else if (MiscUtility.GetBool(valve.member, PLCConstants.POS_VALVE_CLOSED))
            {
                result = CLOSED;
            }
            else
            {
                result = UNKNOW;
            }

            return(result);
        }
コード例 #15
0
        private static void LoadForCurListItem(ListItemCollection lstItems, ListItem curItem, DataTable source, bool superUser)
        {
            int curCommandId = ConvertUtility.ToInt32(curItem.Value);
            int level        = ConvertUtility.ToInt32(curItem.Attributes["Level"]);

            level++;
            DataRow[] drChildCommands = source.Select("CommandParentID = " + curCommandId);
            foreach (DataRow row in drChildCommands)
            {
                if (!superUser && (bool)row["IsSuperUser"])
                {
                    continue;
                }
                ListItem item = new ListItem(MiscUtility.StringIndent(level) + row["CommandName"].ToString(), row["CommandID"].ToString());
                item.Attributes.Add("Level", level.ToString());
                lstItems.Add(item);
                LoadForCurListItem(lstItems, item, source, superUser);
            }
        }
コード例 #16
0
        public static void LoadForCurItem(ListItemCollection lstItems, ListItem curItem, int idTrungTam, int idPhongBan, DateTime dt, int idDotDanhGia, int UserID)
        {
            int curId = ConvertUtility.ToInt32(curItem.Value);
            int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]);

            level++;
            DataTable dtChildZones = GetAllByParentID(curId, idTrungTam, idPhongBan, dt, idDotDanhGia, UserID);

            if (dtChildZones == null)
            {
                return;
            }
            foreach (DataRow row in dtChildZones.Rows)
            {
                ListItem item = new ListItem(MiscUtility.StringIndent(level) + "(" + Math.Round(ConvertUtility.ToDouble(row["TyTrong"].ToString()), 3) + "%) " + row["Ten"].ToString(), row["ID"].ToString());
                item.Attributes.Add("Level", level.ToString());
                lstItems.Add(item);
                LoadForCurItem(lstItems, item, idTrungTam, idPhongBan, dt, idDotDanhGia, UserID);
            }
        }
コード例 #17
0
            public void CompareCommonProperties(ServiceTypeDescription expected, ServiceTypeDescription actual)
            {
                Assert.AreEqual(expected.ServiceTypeName, actual.ServiceTypeName);
                Assert.AreEqual(expected.PlacementConstraints, actual.PlacementConstraints);

                if (expected.ServiceTypeKind == ServiceDescriptionKind.Stateful)
                {
                    MiscUtility.CompareEnumerables(expected.LoadMetrics as IEnumerable <StatefulServiceLoadMetricDescription>, actual.LoadMetrics as IEnumerable <StatefulServiceLoadMetricDescription>, StatefulServiceLoadMetricDescriptionTest.StatefulHelperInstance.Compare);
                }
                else
                {
                    MiscUtility.CompareEnumerables(expected.LoadMetrics as IEnumerable <StatelessServiceLoadMetricDescription>, actual.LoadMetrics as IEnumerable <StatelessServiceLoadMetricDescription>, StatelessServiceLoadMetricDescriptionTest.StatelessHelperInstance.Compare);
                }

                MiscUtility.CompareEnumerables(expected.Extensions.Keys, actual.Extensions.Keys);
                foreach (string key in expected.Extensions.Keys)
                {
                    Assert.AreEqual(expected.Extensions[key], actual.Extensions[key]);
                }
            }
コード例 #18
0
        public static void LoadForCurItem(ListItemCollection lstItems, ListItem curItem, int idTrungTam)
        {
            int curId = ConvertUtility.ToInt32(curItem.Value);
            int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]);

            level++;
            DataTable dtChildZones = GetAllByParentID(curId, idTrungTam);

            if (dtChildZones == null)
            {
                return;
            }
            foreach (DataRow row in dtChildZones.Rows)
            {
                ListItem item = new ListItem(MiscUtility.StringIndent(level) + row["Ten"].ToString(), row["ID"].ToString());
                item.Attributes.Add("Level", level.ToString());
                lstItems.Add(item);
                LoadForCurItem(lstItems, item, idTrungTam);
            }
        }
コード例 #19
0
        protected void dtgDeployList_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemIndex < 0)
            {
                return;
            }
            DataRowView rowData = (DataRowView)e.Item.DataItem;

            DropDownList dropContentRank = (DropDownList)e.Item.FindControl("dropContentRank");

            dropContentRank.Items.FindByValue(rowData["Distribution_Rank"].ToString()).Selected = true;

            DropDownList dropIndex = (DropDownList)e.Item.FindControl("dropIndex");

            MiscUtility.FillIndex(dropIndex, MAX_PRIORITY, ConvertUtility.ToInt32(rowData["Distribution_Priority"]));

            HyperLink lnkHeadline = (HyperLink)e.Item.FindControl("lnkHeadline");

            lnkHeadline.Text        = DistributionDB.GetNameByDistID(ConvertUtility.ToInt32(e.Item.Cells[0].Text));
            lnkHeadline.NavigateUrl = AppEnv.ADMIN_CMD + "cmsviewcontent&contentID=" + e.Item.Cells[1].Text;

            lnkHeadline.ToolTip = ContentDB.GetAuthorInfoByContentID(Convert.ToInt32(e.Item.Cells[1].Text));

            Button cmdRemove = (Button)e.Item.FindControl("cmdRemove");
            Button cmdDel    = (Button)e.Item.FindControl("cmdDel");
            Button cmdEdit   = (Button)e.Item.FindControl("cmdEdit");

            if (!isManager && !isDeployer)
            {
                cmdDel.Enabled          = false;
                cmdEdit.Enabled         = false;
                cmdRemove.Enabled       = false;
                dropContentRank.Enabled = false;
                dropIndex.Enabled       = false;
            }
            else
            {
                cmdRemove.Attributes.Add("onclick", MiscUtility.DELETE_CONFIRM);
                cmdDel.Attributes.Add("onclick", MiscUtility.DELETE_CONFIRM);
            }
        }
コード例 #20
0
        public void Lync_FabricExitedNotification()
        {
            const int hostCount       = 10;
            bool      hasFabricExited = false;

            using (var deployment = LyncScenarioTestHelper.CreateDeployment("Lync_FabricExitedNotification"))
            {
                var lyncHostList = new List <LyncScenarioTestHelper.LyncHostInfo>();
                for (int i = 0; i < hostCount; i++)
                {
                    lyncHostList.Add(new LyncScenarioTestHelper.LyncHostInfo(deployment.Nodes.First(), Enumerable.Empty <Type>(), false));
                }

                // let the host come up
                LogHelper.Log("Starting processes");
                for (int i = 0; i < hostCount; i++)
                {
                    lyncHostList[i].StartProcess(deployment.TestOutputPath, "exitnotification_" + i.ToString());
                }

                // kill the fabric node
                LogHelper.Log("Killing fabric.exe");
                deployment.Nodes.First().Dispose();

                // assert that the host received the notification
                MiscUtility.WaitUntil(() =>
                {
                    LogHelper.Log("Querying host");
                    hasFabricExited = Enumerable.All(lyncHostList, e => e.QueryHasFabricExited());
                    return(hasFabricExited);
                }, TimeSpan.FromSeconds(5), 200);

                LogHelper.Log("Stopping Host");
                lyncHostList.ForEach(e => e.StopProcess());

                LogHelper.Log("Dispose");
                lyncHostList.ForEach(e => e.Dispose());
            }

            Assert.IsTrue(hasFabricExited);
        }
コード例 #21
0
        public static DataTable LoadPortalForCur(DataTable dtPortal, DataRow curItem, DataTable dtReturnPortal)
        {
            int level = Convert.ToInt32(curItem["Level"]);

            level += 1;
            int _portalID = Convert.ToInt32(curItem["PortalID"]);

            DataRow[] dtChild = GetPortalByParentID(dtPortal, _portalID);
            foreach (DataRow row in dtChild)
            {
                DataRow childItem = dtReturnPortal.NewRow();

                childItem["PortalID"]           = row["PortalID"].ToString();
                childItem["Portal_Description"] = row["Portal_Description"];
                childItem["Portal_ParentId"]    = row["Portal_ParentId"];
                childItem["Portal_Name"]        = MiscUtility.StringIndent(level) + row["Portal_Name"].ToString();
                childItem["Level"] = level;
                dtReturnPortal.Rows.Add(childItem);
                LoadPortalForCur(dtPortal, childItem, dtReturnPortal);
            }
            return(dtReturnPortal);
        }
コード例 #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack == false)
            {
                int id = -1;

                id = MiscUtility.ParseInt32(Request["id"], -1);

                if (id == -1)
                {
                    m_labelId.Text          = id.ToString();
                    m_textEmailAddress.Text = "";
                    m_textFirstName.Text    = "";
                    m_textLastName.Text     = "";
                    m_textPhone.Text        = "";
                    m_chkIsActive.Checked   = true;
                }
                else
                {
                    WebTestingDataSet.PersonRow person = DatasetUtility.GetPerson(id);

                    m_labelId.Text          = person.Id.ToString();
                    m_textEmailAddress.Text = person.EmailAddress;
                    m_textFirstName.Text    = person.FirstName;
                    m_textLastName.Text     = person.LastName;
                    m_textPhone.Text        = person.PhoneNumber;

                    if (person.Status == "ACTIVE")
                    {
                        m_chkIsActive.Checked = true;
                    }
                    else
                    {
                        m_chkIsActive.Checked = false;
                    }
                }
            }
        }
コード例 #23
0
        public JsonResult Save(string fileName)
        {
            var jo = new Dictionary <string, string>();

            CropImageUtility cropUtils = new CropImageUtility(this.UploadPath, this.OriginalPath, string.Empty);
            var result = cropUtils.SaveUploadImageToOriginalFolder(fileName);

            if (!result["result"].Equals("success", StringComparison.OrdinalIgnoreCase))
            {
                jo.Add("result", result["result"]);
                jo.Add("msg", result["msg"]);

                return(Json(jo));
            }

            try
            {
                UploadImage instance = new UploadImage()
                {
                    ID            = Guid.NewGuid(),
                    OriginalImage = fileName,
                    CreateDate    = DateTime.Now,
                    UpdateDate    = DateTime.Now
                };

                service.Add(instance);

                jo.Add("result", "success");
                jo.Add("msg", string.Format(@"/{0}/{1}", OriginalFolder, fileName));
                jo.Add("id", instance.ID.ToString());

                return(Json(jo));
            }
            catch (Exception ex)
            {
                return(Json(MiscUtility.GetExceptionMsg(ex.Message)));
            }
        }
コード例 #24
0
        public static DataTable LoadRoleForCur(DataTable dtRole, DataRow curItem, DataTable dtReturnRole)
        {
            int level = Convert.ToInt32(curItem["Level"]);

            level += 1;
            int _roleID = Convert.ToInt32(curItem["RoleID"]);

            DataRow[] dtChild = GetRoleByParentID(dtRole, _roleID);

            foreach (DataRow row in dtChild)
            {
                DataRow childItem = dtReturnRole.NewRow();

                childItem["RoleID"]          = row["RoleID"].ToString();
                childItem["RoleParentID"]    = row["RoleParentID"];
                childItem["RoleDescription"] = row["RoleDescription"];
                childItem["RoleName"]        = MiscUtility.StringIndent(level) + row["RoleName"].ToString();
                childItem["Level"]           = level;
                dtReturnRole.Rows.Add(childItem);
                LoadRoleForCur(dtRole, childItem, dtReturnRole);
            }
            return(dtReturnRole);
        }
コード例 #25
0
        protected void tvwCmds_NodeSelected(object sender, TreeViewNodeEventArgs e)
        {
            int     curID = ConvertUtility.ToInt32(e.Node.ID);
            CmdInfo info  = CmdDB.GetInfo(curID);

            if (info == null)
            {
                cmdEmpty_Click(null, null);
                return;
            }

            txtID.Text     = info.Cmd_ID.ToString();
            txtName.Text   = info.Cmd_Name;
            txtCmd.Text    = info.Cmd_Value;
            txtParams.Text = info.Cmd_Params;
            txtPath.Text   = info.Cmd_Path;
            txtUrl.Text    = info.Cmd_Url;

            int maxIndex = CmdDB.GetChildCount(info.Cmd_ParentID);

            MiscUtility.FillIndex(dropIndex, maxIndex, info.Cmd_Index);
            chkEnable.Checked = info.Cmd_Enable;
            chkVisble.Checked = info.Cmd_Visible;
        }
コード例 #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (ConvertUtility.ToBoolean(AppEnv.AdvInZone))
                {
                    ZoneUtility.LoadZones(lstZones.Items); lstZones.Enabled = true;
                }
                else
                {
                    lstZones.Enabled = false;
                }
                lstZones.Items.Insert(0, new ListItem("Root 0", "0"));
                lstZones.SelectedIndex = 0;

                lstPositions.DataSource     = PositionDB.GetAll();
                lstPositions.DataTextField  = "Pos_Name";
                lstPositions.DataValueField = "Pos_ID";
                lstPositions.DataBind();
                lstPositions.SelectedIndex = -1;
                MiscUtility.SetSelected(lstPositions.Items, PosSelected.ToString());
            }
            lblUpdateStatus.Text = string.Empty;
        }
コード例 #27
0
            private void Init(MethodBase methodBase, string msg, TimeSpan elapsedTime, Color color, bool isException)
            {
                if (methodBase != null)
                {
                    this.MethodInfo = "[ " + methodBase.ReflectedType.Name + "." + methodBase.Name + " ]";
                }
                this.MessageOriginal = msg;
                if (isException)
                {
                    this.MessageFormatted = "[ ERROR ]" + this.MethodInfo + " [ Failed with message = " + msg + " ]";
                }
                else
                {
                    this.MessageFormatted = this.MethodInfo + (String.IsNullOrEmpty(msg) ? "" : "[ " + msg + " ]");
                }

                if (elapsedTime != TimeSpan.MinValue)
                {
                    string elapsed = "[ Elapsed Time = " + MiscUtility.FormatTimeSpan(elapsedTime) + " ]";
                    this.MessageOriginal  += elapsed;
                    this.MessageFormatted += elapsed;
                }
                this.MessageColor = color;
            }
コード例 #28
0
        protected void dtgData_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                var id = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                try
                {
                    ContentVideoDB.Delete(_contentId, id);

                    VideoDB.Delete(id);

                    lblStatusUpdate.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR;
                }
            }
            if (e.CommandName == "updaterow")
            {
                try
                {
                    var id   = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                    var info = VideoDB.GetInfo(id);

                    var txtPriority = (TextBox)e.Item.FindControl("txtPriority");
                    var chkVisible  = (CheckBox)e.Item.FindControl("chkVisible");

                    info.Video_Visible = ConvertUtility.ToBoolean(chkVisible.Checked);

                    VideoDB.Update(info);

                    var ctinfo = ContentVideoDB.GetInfo(_contentId, id);

                    ctinfo.Priority = ConvertUtility.ToInt32(txtPriority.Text);

                    ContentVideoDB.Update(ctinfo);

                    lblStatusUpdate.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR; //ex.ToString();
                }
            }
            if (e.CommandName == "editrow")
            {
                lblStatusUpdate.Text = lblStatusUpdate2.Text = string.Empty;

                var id   = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                var info = VideoDB.GetInfo(id);

                dropType.ClearSelection();
                MiscUtility.SetSelected(dropType.Items, info.Video_Type);
                chkVisible.Checked = info.Video_Visible;
                txtFile.Text       = info.Video_File;
                txtYoutube.Text    = info.Video_YouTube;
                txtName.Text       = info.Video_Name;
                txtTeaser.Text     = info.Video_Description;
                txtID.Text         = id.ToString();
            }
        }
コード例 #29
0
        /// <summary>
        /// Handle a command received from chat.
        /// This is after filtering to make sure a message is a command.
        /// </summary>
        internal void HandleCommandReceived(SenderSettings senderSettings, IMessageDetail message)
        {
            bool             success;
            IList <Response> responses;

            try
            {
                responses = commandHandlerController.ExecuteCommand(senderSettings, message);
                success   = true;
            }
            catch (Exception ex)
            {
                ErrorLogger.LogException(ex, ErrorSeverity.Error);
                ErrorLogger.LogDebug($"Exception while handling: {message}", false);
                responses = new List <Response>
                {
                    new Response {
                        Message = $"{Emojis.ExclamationSymbol} {languageHandler.GetPhrase(senderSettings.ServerSettings.Language, "Error_Oops")}: {ex.Message}"
                    }
                };
                success = false;
            }

            if (dumpDebug)
            {
                var sb = MiscUtility.DumpObject(message);
                ErrorLogger.LogDebug("Handled " + message.GetType() + ": \r\n" + sb, true);
            }

            if (responses.Count > 0)
            {
                foreach (Response response in responses)
                {
                    OnCommandReceived?.Invoke(this, new CommandReceivedEventArgs(senderSettings, message, response));
                    /// Handled by <see cref="SlateBotController_OnCommandReceived"/>
                    /// and the <see cref="UserSettingsHandler"/>
                    if (dumpDebug)
                    {
                        var sb = MiscUtility.DumpObject(response);
                        ErrorLogger.LogDebug("Response " + response.GetType() + ": \r\n" + sb, true);
                    }
                }

                if ((message is SocketMessageWrapper smw) && (smw.socketMessage is SocketUserMessage sum))
                {
                    // Help out if we're debugging.
                    if (Debugger.IsAttached)
                    {
                        var sb = MiscUtility.DumpObject(sum);
                        ErrorLogger.LogDebug("Handled " + sum.GetType() + ": \r\n" + sb, dumpDebug);
                    }

                    // React to the message handled.
                    sum.AddReactionAsync(new Emoji(success ? Emojis.CheckUnicode : Emojis.CrossSymbol)).ConfigureAwait(false);
                }
            }
            else if (message is ConsoleMessageDetail) // If from the console
            {
                ErrorLogger.LogDebug(NO_RESPONSE_CONSOLE_MESSAGE + "(" + message.Message + ")", true);
            }
        }
コード例 #30
0
        protected void dtgUsers_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "edit")
            {
                UserInfo user = UserDB.GetInfo(Convert.ToInt32(e.Item.Cells[0].Text));
                if (user == null)
                {
                    cmdEmpty_Click(null, null);
                    return;
                }
                txtID.Text       = user.User_ID.ToString();
                txtFullName.Text = user.User_FullName;
                txtEmail.Text    = user.User_Email;
                txtBirthDay.Text = user.User_Birthday;
                txtPhone.Text    = user.User_Phone;
                txtAddress.Text  = user.User_Address;

                chkIsSuperAdmin.Checked = user.User_SuperAdmin;

                dropGender.SelectedIndex = -1;
                MiscUtility.SetSelected(dropGender.Items, Convert.ToInt32(user.User_Gender).ToString());

                string groups = "|";

                DataTable dtGroups = GroupMemberDB.GetUserGroups(user.User_ID);
                foreach (DataRow row in dtGroups.Rows)
                {
                    groups += row["Group_ID"] + "|";
                }
                foreach (ListItem item in lstGroups.Items)
                {
                    if (groups.IndexOf("|" + item.Value + "|") >= 0)
                    {
                        item.Selected = true;
                    }
                    else
                    {
                        item.Selected = false;
                    }
                }
            }
            if (e.CommandName == "del")
            {
                try
                {
                    UserDB.Delete(Convert.ToInt32(e.Item.Cells[0].Text));
                    lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
                    cmdEmpty_Click(null, null);
                }
                catch
                {
                    lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR;
                }
            }
            if (e.CommandName == "roles")
            {
                Response.Redirect(AppEnv.ADMIN_CMD + "mainusercmdroles&userid=" + e.Item.Cells[0].Text);
            }
            if (e.CommandName == "stores")
            {
                Response.Redirect(AppEnv.ADMIN_CMD + "cmduserstoremanagement&userid=" + e.Item.Cells[0].Text);
            }
        }