Наследование: MonoBehaviour
Пример #1
0
    protected string LoadImages(int id)
    {
        string            sql  = "SELECT File_ID,File_Name,File_Small,File_Larger FROM tbl_File WHERE Content_ID=" + id + " AND File_Status=1 ORDER BY File_Pos";
        DataSet           ds   = UpdateData.UpdateBySql(sql);
        DataRowCollection rows = ds.Tables[0].Rows;
        StringBuilder     str  = new StringBuilder();

        if (rows.Count > 0)
        {
            str.Append("<div class=\"custom-grid-row\">\n");
            for (int i = 0; i < rows.Count; i++)
            {
                str.Append("    <div class=\"col-1-2\">\n");
                str.Append("    <a href=\"" + rows[i]["File_Larger"] + "\" class=\"zoom\">");
                str.Append("        <img src=\"" + rows[i]["File_Small"] + "\" class=\"img-responsive wow zoomIn\" alt=\"" + rows[i]["File_Name"] + "\">\n");
                str.Append("    </a>\n");
                str.Append("    </div>\n");
                //if (i != 0 && i % 2 == 0) str.Append("</div><div class=\"custom-grid-row\">");
            }
            str.Append("</div>\n");
            //if (i != 0 && i % 2 == 0) str.Append("</div>");
        }
        return(str.ToString());
    }
Пример #2
0
        //2 CODE_DIGITAL
        private UpdateData Update_1_2()
        {
            UpdateData data = new UpdateData();

            //bool ima = false;
            // Read specific values in the table.
            using (SqlCommand com = new SqlCommand("SELECT Idd, Dataset, Value, Code  FROM Dataset1 WHERE Idd = 2", sqlConnection))
            {
                SqlDataReader reader = com.ExecuteReader();
                if (reader.HasRows)
                {
                    //reader.Read();
                    //data.value = Convert.ToInt32(reader.GetValue(2));
                    data.ima = true;
                }
                else
                {
                    data.ima = false;
                }

                reader.Close();
            }
            return(data);
        }
Пример #3
0
    protected string GetSubMenu(int cat)
    {
        StringBuilder     str  = new StringBuilder();
        string            sql  = "SELECT Mod_ID,Mod_Name,Mod_Code FROM tbl_Mod WHERE lang=" + Session["vlang"] + " AND Mod_Status=1 AND Mod_Parent=" + cat + " ORDER BY Mod_Pos";
        DataSet           ds   = UpdateData.UpdateBySql(sql);
        DataRowCollection rows = ds.Tables[0].Rows;

        //===================================================
        if (rows.Count > 0)
        {
            str.Append("<ul>\n");
            for (int i = 0; i < rows.Count; i++)
            {
                int    id  = Convert.ToInt32(rows[i]["Mod_ID"]);
                string n   = rows[i]["Mod_Name"].ToString();
                string c   = rows[i]["Mod_Code"].ToString();
                string url = ResolveUrl("~/" + c + ".htm");
                //string css = (i == 0) ? " class=\"active\"" : "";
                str.Append("    <li><a href=\"" + url + "\" title=\"" + n + "\">" + n + "</a></li>\n");
            }
            str.Append("</ul>\n");
        }
        return(str.ToString());
    }
Пример #4
0
        private static async Task ProcessUpdateAsync(UpdateData update, string pOutputFolder, MachineType MachineType, string Language = "", string Edition = "", bool WriteMetadata = true)
        {
            HashSet <CompDBXmlClass.PayloadItem> payloadItems       = new HashSet <CompDBXmlClass.PayloadItem>();
            HashSet <CompDBXmlClass.PayloadItem> bannedPayloadItems = new HashSet <CompDBXmlClass.PayloadItem>();
            HashSet <CompDBXmlClass.CompDB>      specificCompDBs    = new HashSet <CompDBXmlClass.CompDB>();

            string buildstr = "";
            IEnumerable <string> languages = null;

            int returnCode = 0;
            IEnumerable <CExtendedUpdateInfoXml.File> filesToDownload = null;

            bool getSpecific         = !string.IsNullOrEmpty(Language) && !string.IsNullOrEmpty(Edition);
            bool getSpecificLanguage = !string.IsNullOrEmpty(Language) && string.IsNullOrEmpty(Edition);

            Logging.Log("Gathering update metadata...");

            var compDBs = await update.GetCompDBsAsync();

            await Task.WhenAll(
                Task.Run(async() => buildstr  = await update.GetBuildStringAsync()),
                Task.Run(async() => languages = await update.GetAvailableLanguagesAsync()));

            CompDBXmlClass.Package editionPackPkg = compDBs.GetEditionPackFromCompDBs();
            string editionPkg = await update.DownloadFileFromDigestAsync(editionPackPkg.Payload.PayloadItem.PayloadHash);

            var plans = await Task.WhenAll(languages.Select(x => update.GetTargetedPlanAsync(x, editionPkg)));

            foreach (var plan in plans)
            {
                Logging.Log("");
                Logging.Log("Editions available for language: " + plan.LanguageCode);
                plan.EditionTargets.PrintAvailablePlan();
            }

            string name         = $"{buildstr.Replace(" ", $".{MachineType.ToString().ToLower()}fre.").Replace("(", "").Replace(")", "")}_{update.Xml.UpdateIdentity.UpdateID.Split("-")[^1]}";
Пример #5
0
    public void bindToDropDown(DropDownList ddl)
    {
        string            sql  = "SELECT Mod_ID,Mod_Parent,Mod_Name,Mod_Level FROM tbl_Mod WHERE Mod_ID in(SELECT Mod_ID FROM tbl_ModsiteUser WHERE User_ID=" + Session["UserID"] + ") ORDER BY Mod_Pos";
        DataSet           ds   = UpdateData.UpdateBySql(sql);
        DataRowCollection rows = ds.Tables[0].Rows;

        for (int i = 0; i < rows.Count; i++)
        {
            if (rows[i]["Mod_Parent"].ToString() == "0")
            {
                ListItem item = new ListItem();
                item.Text  = rows[i]["Mod_Name"].ToString();
                item.Value = rows[i]["Mod_ID"].ToString();
                ddl.Items.Add(item);
                ddl.Attributes.Add("style", "color:#FF3300");
                GetChildItems(rows[i]["Mod_ID"].ToString(), ds, ddl);
            }
        }
        ListItem topitem = new ListItem();

        topitem.Text  = "--------------Chọn nhóm--------------";
        topitem.Value = "-1";
        ddl.Items.Insert(0, topitem);
    }
Пример #6
0
    public static string getAllOrderDetail()
    {
        string            sql  = "select * from tbl_OrderDetail";
        DataTable         ds   = UpdateData.UpdateBySql(sql).Tables[0];
        DataRowCollection rows = ds.Rows;
        StringBuilder     str  = new StringBuilder();

        if (rows.Count > 0)
        {
            str.Append("[");
            for (int i = 0; i < rows.Count; i++)
            {
                str.Append("{");
                str.Append("\"Order_ID\":\"" + rows[i]["Order_ID"] + "\",\"MaVe\":\"" + rows[i]["Mave"] + "\",\"UnitPrice\":\"" + rows[i]["unitPrice"] + "\",\"Type\":\"" + rows[i]["Type"] + "\",\"isTimeOut\":\"" + rows[i]["isTimeOut"] + "\"");
                str.Append("}");
                if (i < rows.Count - 1)
                {
                    str.Append(",");
                }
            }
            str.Append("]");
        }
        return(str.ToString());
    }
Пример #7
0
    protected void lbtUpdate_Click(object sender, EventArgs e)
    {
        string sScritp = "<script>";

        sScritp += "parent.HideModal('#add-modal'); parent.window.location.reload();";
        sScritp += "</script>";

        Hashtable tbIn  = new Hashtable();
        string    isUse = (cbIsUse.Checked == true) ? "1" : "0";

        tbIn.Add("Config_Name", txtName.Text);
        tbIn.Add("Config_Code", txtCode.Text);
        tbIn.Add("Config_Values", txtValues.Text);
        tbIn.Add("Config_Status", isUse);
        if (act == "add")
        {
            bool _insert = UpdateData.Insert("tbl_Config", tbIn);
        }
        if (act == "edit")
        {
            bool _update = UpdateData.Update("tbl_Config", tbIn, "Config_ID=" + id);
        }
        Response.Write(sScritp);
    }
Пример #8
0
 protected void lbtDelAll_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow item in gvData.Rows)
     {
         CheckBox cbItem = (CheckBox)item.FindControl("cbItem");
         if (cbItem.Checked)
         {
             int iddel = Convert.ToInt32(gvData.DataKeys[item.RowIndex].Value.ToString());
             try
             {
                 if (AuthenticationMenu.CheckPermission(iddel, int.Parse(Session["UserId"].ToString())))
                 {
                     UpdateData.Delete("tbl_ModSiteUser", "User_Id=" + int.Parse(Session["UserID"].ToString()));
                 }
                 UpdateData.Delete("tbl_Mod", "Mod_ID=" + iddel);
             }
             catch (Exception)
             {
                 Response.Write("<script>alert('Module tại trong 1 module khác hoặc được sở hữu bởi 1 người khác, bạn không thể xóa nó');</script>");
             }
         }
     }
     BindData();
 }
Пример #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     act  = Request["act"];
     id   = Request["id"];
     pbid = Request["pbid"];
     if (!IsPostBack)
     {
         this.loadDepartment();
         this.LoadRole();
         string    sql  = "Select ID as id, TenNhaXe as text from Nhaxe";
         DataTable dtNX = UpdateData.UpdateBySql(sql).Tables[0];
         Value.BindToDropdown(ddlNhaXe, dtNX);
         if (act == "add")
         {
             for (int i = 0; i < ddlPb.Items.Count; i++)
             {
                 if (ddlPb.Items[i].Value == pbid)
                 {
                     ddlPb.Items[i].Selected = true;
                 }
             }
             for (int i = 0; i < dllRole.Items.Count; i++)
             {
                 if (dllRole.Items[i].Value == pbid)
                 {
                     dllRole.Items[i].Selected = true;
                 }
             }
         }
         if (act == "edit")
         {
             txtUser.Enabled = false;
             ViewEdit(id);
         }
     }
 }
Пример #10
0
    public void ViewEdit(string id)
    {
        string            sql  = "SELECT * FROM tbl_DocsType WHERE DocsType_ID=" + id;
        DataSet           ds   = UpdateData.UpdateBySql(sql);
        DataRowCollection rows = ds.Tables[0].Rows;

        if (rows.Count > 0)
        {
            txtName.Text  = rows[0]["DocsType_Name"].ToString();
            txtDes.Text   = rows[0]["DocsType_Description"].ToString();
            txtPos.Text   = rows[0]["DocsType_Order"].ToString();
            txtImg.Text   = rows[0]["DocsType_Img"].ToString();
            txtTitle.Text = rows[0]["DocsType_Title"].ToString();
            for (int i = 0; i < ddlGroup.Items.Count; i++)
            {
                if (ddlGroup.Items[i].Value == rows[0]["DocsType_ID"].ToString())
                {
                    ddlGroup.Items[i].Selected = true;
                }
            }
            bool isUse = Convert.ToBoolean(rows[0]["DocsType_Status"]);
            cbIsUse.Checked = (isUse == true) ? true : false;
        }
    }
Пример #11
0
    protected string LoadTDDetail()
    {
        string            sql  = "select * from tbl_Content where lang=" + Session["vlang"] + " And Content_Code = '" + nUrl + "' Order By Content_Date DESC";
        DataSet           ds   = UpdateData.UpdateBySql(sql);
        DataRowCollection rows = ds.Tables[0].Rows;
        StringBuilder     str  = new StringBuilder();

        if (rows.Count > 0)
        {
            for (int i = 0; i < rows.Count; i++)
            {
                str.Append("<div class=\"Content_Detail w100 fl\">");
                str.Append("        <h2 style=\"font-weight:bold\">" + rows[i]["Content_Title"].ToString().ToUpper() + "</h2>");
                str.Append("            <div class=\"date-author w100 fl\">");
                str.Append("            <span class=\"caption-date\"><i class=\"fa fa-calendar\"></i>&nbsp;Ngày đăng:" + rows[i]["Content_Date"] + "</span></div>");
                str.Append("        <div class=\"description\"><p>" + rows[i]["Content_Text"] + "</p></div>");
                str.Append("</div>");
                str.Append("<div class=\"td-bot\">");
                str.Append("    <h3 class=\"pull-right\"><button type =\"button\" class=\"btn btn-info btn-lg\" data-toggle=\"modal\" data-target=\"#myModal\">" + Value.GetValue(Session["vlang"].ToString(), "lbApply") + "</button></h3>");
                str.Append("</div>");
            }
        }
        return(str.ToString());
    }
Пример #12
0
 private void Init(
     Stream stream, SevenZipCompressor compressor, UpdateData updateData, bool directoryStructure)
 {
     _fileStream            = new InStreamWrapper(stream, false);
     _fileStream.BytesRead += IntEventArgsHandler;
     _actualFilesCount      = 1;
     try
     {
         _bytesCount = stream.Length;
     }
     catch (NotSupportedException)
     {
         _bytesCount = -1;
     }
     try
     {
         stream.Seek(0, SeekOrigin.Begin);
     }
     catch (NotSupportedException)
     {
         _bytesCount = -1;
     }
     CommonInit(compressor, updateData, directoryStructure);
 }
Пример #13
0
        public static async Task <UpdateQueryResult> UpdateQuery(int lastServerUpdate, List <Item> snapshot)
        {
            var data = new UpdateData
            {
                data = new UpdateData.Data
                {
                    lastServerUpdate = 0,
                    items            = snapshot,
                }
            };

            var q = new StringBuilder(JsonConvert.SerializeObject(data));

            //swap opening and closing {} with () just because too lazy to search how to this 'properly'.
            q[0]            = '(';
            q[q.Length - 1] = ')';

            var input  = Regex.Replace(q.ToString(), @"""([a-zA-z]+)"":", "$1:");
            var output = @"{present { id, name,description,category,amount, unit, bought, lastUpdateTimestamp, }serverTime}";

            var query = $"mutation{{update{input}{output}}}";

            return(await QueryAsync <UpdateQueryResult>(query));
        }
Пример #14
0
        private void NameUpdateThread(object d)
        {
            UpdateData data  = (UpdateData)d;
            bool       abort = false;

            do
            {
                UpdateJob job = null;
                lock (data.jobs) {
                    if (data.jobs.Count > 0)
                    {
                        job = data.jobs.Dequeue();
                    }
                    else
                    {
                        abort = true;
                    }
                }
                if (job != null)
                {
                    string name = GetDisplayName(Profile.DirNametoID64(job.dir));

                    lock (data.tLock) {
                        if (data.tLock.Aborted)
                        {
                            abort = true;
                        }
                        else
                        {
                            UpdateDisplayNameInList(job.index, name);
                        }
                    }
                }
            } while(!abort);
            OnNameUpdateThreadTerminate();
        }
Пример #15
0
        private void UpdateBetaUsers(object sender, EventArgs e)
        {
            var           legendaryupdatedata = new UpdateData();
            var           client  = new WebClient();
            DirectoryInfo startup = Directory.GetParent(Client.ExecutingDirectory);

            if (!Directory.Exists(Path.Combine(startup.ToString(), "Temp")))
            {
                Directory.CreateDirectory(Path.Combine(startup.ToString(), "Temp"));
            }

            string downloadLink =
                new WebClient().DownloadString("http://eddy5641.github.io/LegendaryClient/downloadLink");
            string filename = new WebClient().DownloadString("http://eddy5641.github.io/LegendaryClient/filename");

            client.DownloadProgressChanged += client_DownloadProgressChanged;
            string downloadLocation = "https://github.com/eddy5641/LegendaryClient/releases/download/" + downloadLink;

            LogTextBox("Retreving Update Data from: " + downloadLocation);
            client.DownloadFileAsync(new Uri(downloadLocation),
                                     Path.Combine("Temp", "LegendaryClientBetaTesterUpdateFile.zip"));
            //client.DownloadFileAsync(new Uri(DownloadLocation), Path.Combine("temp", "1.0.1.2.zip"));
            //client.DownloadFileAsync(new Uri(DownloadLocation), filename);
        }
Пример #16
0
    public void ViewEdit(string id)
    {
        string            sql  = "SELECT * FROM tbl_Content WHERE Content_ID=" + id;
        DataSet           ds   = UpdateData.UpdateBySql(sql);
        DataRowCollection rows = ds.Tables[0].Rows;

        if (rows.Count > 0)
        {
            CKTeaser.Text  = rows[0]["Content_Intro"].ToString();
            CKContent.Text = rows[0]["Content_Text"].ToString();
            //txtName.Text        = rows[0]["Content_Code"].ToString();//Họ tên
            txtTile.Text = rows[0]["Content_Name"].ToString();
            txtTel.Text  = rows[0]["Content_Avata"].ToString();
            //txtEmail.Text       = rows[0]["Content_URL"].ToString();
            txtCode.Text    = rows[0]["Content_Code"].ToString();     // liên quan
            txtKey.Text     = rows[0]["Content_Key"].ToString();
            txtTitle.Text   = rows[0]["Content_Title"].ToString();
            txtMeta.Text    = rows[0]["Content_Des"].ToString();
            txtTags.Text    = rows[0]["Content_Tags"].ToString();
            cbIsUse.Checked = (Convert.ToBoolean(rows[0]["Content_Status"]) == true) ? true : false;
            for (int i = 0; i < ddlChuyenkhoa.Items.Count; i++)
            {
                if (rows[0]["Chuyenkhoa_ID"].ToString() == ddlChuyenkhoa.Items[i].Value)
                {
                    ddlChuyenkhoa.Items[i].Selected = true;
                }
            }
            for (int i = 0; i < ddlChuyenmuc.Items.Count; i++)
            {
                if (rows[0]["Chuyenmuc_ID"].ToString() == ddlChuyenmuc.Items[i].Value)
                {
                    ddlChuyenmuc.Items[i].Selected = true;
                }
            }
        }
    }
Пример #17
0
 private void button1_Click(object sender, System.EventArgs e)
 {
     if (string.IsNullOrEmpty(txtClientName.Text))
     {
         MessageBox.Show("请输入客户姓名");
     }
     if (string.IsNullOrEmpty(txtClientPhone.Text))
     {
         MessageBox.Show("请输入客户手机");
     }
     //插入
     if (_opearType == "添加")
     {
         var sql = InsertSQL.InsertClient(txtClientName.Text, txtClientPhone.Text);
         MessageBox.Show(InsertData.InsertIntoData(sql) ? "添加客户成功" : "添加客户失败");
     }
     //更新
     if (_opearType == "修改")
     {
         var updatesql = UpdateSQL.UpdateClient(txtClientName.Text, txtClientPhone.Text, _clientId);
         MessageBox.Show(UpdateData.UpdateInfo(updatesql) ? "更新客户成功" : "更新客户失败");
     }
     Close();
 }
Пример #18
0
    public void ViewEdit(string id)
    {
        string            sql  = "SELECT * FROM tbl_Content WHERE Content_ID=" + id;
        DataSet           ds   = UpdateData.UpdateBySql(sql);
        DataRowCollection rows = ds.Tables[0].Rows;

        if (rows.Count > 0)
        {
            txtName.Text = rows[0]["Content_Name"].ToString();
            txtLink.Text = rows[0]["Content_URL"].ToString();
            //fpFileAvata.Text    = rows[0]["Content_Avata"].ToString();
            txtImg.Text     = rows[0]["Content_Img"].ToString();
            txtPos.Text     = rows[0]["Content_Pos"].ToString();
            cbIsUse.Checked = (Convert.ToBoolean(rows[0]["Content_Status"]) == true) ? true : false;
            cbIsHot.Checked = (Convert.ToBoolean(rows[0]["Content_Hot"]) == true) ? true : false;
            for (int i = 0; i < ddlModID.Items.Count; i++)
            {
                if (rows[0]["Mod_ID"].ToString() == ddlModID.Items[i].Value)
                {
                    ddlModID.Items[i].Selected = true;
                }
            }
        }
    }
Пример #19
0
 private void Init(
     FileInfo[] files, int rootLength, SevenZipCompressor compressor,
     UpdateData updateData, bool directoryStructure)
 {
     _files = files;
     _rootLength = rootLength;
     if (files != null)
     {
         foreach (var fi in files)
         {
             if (fi.Exists)
             {
                 _bytesCount += fi.Length;
                 if ((fi.Attributes & FileAttributes.Directory) == 0)
                 {
                     _actualFilesCount++;
                 }
             }
         }
     }
     CommonInit(compressor, updateData, directoryStructure);
 }
Пример #20
0
 /// <summary>
 /// Initializes a new instance of the ArchiveUpdateCallback class
 /// </summary>
 /// <param name="streamDict">Dictionary&lt;file stream, name of the archive entry&gt;</param>
 /// <param name="password">The archive password</param>
 /// <param name="compressor">The owner of the callback</param>
 /// <param name="updateData">The compression parameters.</param>
 /// <param name="directoryStructure">Preserve directory structure.</param>
 public ArchiveUpdateCallback(
     Dictionary<string, Stream> streamDict, string password,
     SevenZipCompressor compressor, UpdateData updateData, bool directoryStructure)
     : base(password)
 {
     Init(streamDict, compressor, updateData, directoryStructure);
 }
Пример #21
0
        public static void UpdateSmifStatus(string NodeName, string Data)
        {
            try
            {
                Form     form = Application.OpenForms["FormManual"];
                ComboBox portName;
                if (form == null)
                {
                    return;
                }

                portName = form.Controls.Find("Cb_SMIFSelect", true).FirstOrDefault() as ComboBox;
                if (portName == null)
                {
                    return;
                }

                if (portName.InvokeRequired)
                {
                    UpdateData ph = new UpdateData(UpdateSmifStatus);
                    portName.BeginInvoke(ph, NodeName, Data);
                }
                else
                {
                    if (portName.Text.Equals(NodeName))
                    {
                        Node          port   = NodeManagement.Get(NodeName);
                        MessageParser parser = new MessageParser(port.Brand);
                        port.Status = parser.ParseMessage(Transaction.Command.LoadPortType.ReadStatus, Data);

                        foreach (KeyValuePair <string, string> item in port.Status)
                        {
                            Label StsLb = form.Controls.Find(item.Key + "_lb", true).FirstOrDefault() as Label;
                            if (StsLb != null)
                            {
                                StsLb.Text = item.Value;
                                if (item.Key.Equals("SLOTPOS"))
                                {
                                    ComboBox Slot_cb = form.Controls.Find("Move_To_Slot_cb", true).FirstOrDefault() as ComboBox;

                                    if (Slot_cb != null)
                                    {
                                        if (item.Value.Equals("255"))
                                        {
                                            Slot_cb.SelectedIndex = 0;
                                        }
                                        else
                                        {
                                            Slot_cb.SelectedIndex = Convert.ToInt32(item.Value);
                                        }
                                    }
                                    //Lab_I_Slot_11
                                    for (int i = 1; i <= 25; i++)
                                    {
                                        StsLb = form.Controls.Find("Lab_I_Slot_" + i.ToString("00"), true).FirstOrDefault() as Label;
                                        if (i == Convert.ToInt32(item.Value))
                                        {
                                            StsLb.BackColor = Color.Yellow;
                                        }
                                        else
                                        {
                                            StsLb.BackColor = Color.Silver;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                logger.Error("UpdateSmifStatus: Update fail.");
            }
        }
Пример #22
0
 protected override void DeleteRow()
 {
     try
     {
         bool xoa = false;
         if (dgv_DanhSach.Selected.Rows.Count > 0)
         {
             if (DialogResult.Yes ==
                 MessageBox.Show(FormResource.msgHoixoa, FormResource.MsgCaption, MessageBoxButtons.YesNo,
                                 MessageBoxIcon.Question))
             {
                 foreach (var row in dgv_DanhSach.Selected.Rows)
                 {
                     var masv    = row.Cells["MaSV"].Text;
                     var idPhong = row.Cells["IdPhong"].Text;
                     if (!string.IsNullOrEmpty(idPhong))
                     {
                         var ktp = new KTPhong
                         {
                             IdKyThi = _idkythi,
                             IdPhong = int.Parse(idPhong)
                         };
                         _listKtPhong.Add(ktp);
                     }
                     var xp = new XepPhong
                     {
                         IdKyThi = _idkythi,
                         IdSV    = int.Parse(masv)
                     };
                     _listXepPhong.Add(xp);
                 }
                 DeleteAndUpdate = true;
                 dgv_DanhSach.DeleteSelectedRows(false);
                 xoa = true;
             }
         }
         else if (dgv_DanhSach.ActiveRow != null)
         {
             if (DialogResult.Yes ==
                 MessageBox.Show(FormResource.msgHoixoa, FormResource.MsgCaption, MessageBoxButtons.YesNo,
                                 MessageBoxIcon.Question))
             {
                 var masv    = dgv_DanhSach.ActiveRow.Cells["MaSV"].Text;
                 var idPhong = dgv_DanhSach.ActiveRow.Cells["IdPhong"].Text;
                 if (!string.IsNullOrEmpty(idPhong))
                 {
                     var ktp = new KTPhong
                     {
                         IdKyThi = _idkythi,
                         IdPhong = int.Parse(idPhong)
                     };
                     _listKtPhong.Add(ktp);
                 }
                 var xp = new XepPhong
                 {
                     IdKyThi = _idkythi,
                     IdSV    = int.Parse(masv)
                 };
                 _listXepPhong.Add(xp);
                 DeleteAndUpdate = true;
                 dgv_DanhSach.ActiveRow.Delete(false);
                 xoa = true;
             }
         }
         UpdateData.UpdateGiamSiSo(_listKtPhong);
         DeleteData.XoaXepPhong(_listXepPhong);
         if (xoa)
         {
             MessageBox.Show(@"Xóa dữ liệu thành công.", @"Thông báo");
         }
         LoadGrid();
     }
     catch (Exception ex)
     {
         Log2File.LogExceptionToFile(ex);
     }
 }
Пример #23
0
    public void ReadXml(string XmlFile)
    {
        UpdateFile readXml;
        using (StreamReader reader = new StreamReader(XmlFile))
        {
            XmlSerializer xml = new XmlSerializer(typeof(UpdateFile));
            readXml = (UpdateFile)xml.Deserialize(reader);
        }

        SnakeBite = readXml.SnakeBite;
        Updater = readXml.Updater;
    }
Пример #24
0
 private void Init(
     Dictionary<string, Stream> streamDict,
     SevenZipCompressor compressor, UpdateData updateData, bool directoryStructure)
 {
     _streams = new Stream[streamDict.Count];
     streamDict.Values.CopyTo(_streams, 0);
     _entries = new string[streamDict.Count];
     streamDict.Keys.CopyTo(_entries, 0);
     _actualFilesCount = streamDict.Count;
     foreach (Stream str in _streams)
     {
         if (str != null)
         {
             _bytesCount += str.Length;
         }
     }
     CommonInit(compressor, updateData, directoryStructure);
 }
Пример #25
0
        ////////////////////////////////////////////////////////////////////////////
        //  メソッド名 : MakeUpdateData
        /// <summary>
        /// 
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        /// <history>
        /// 日付    担当者   内容
        /// 2014/07/22  AnhNV      新規作成
        /// </history>
        ////////////////////////////////////////////////////////////////////////////
        private UpdateData MakeUpdateData()
        {
            UpdateData update = new UpdateData();

            // 表示モード
            update.DispMode = string.IsNullOrEmpty(this._yoshiHanbaiChumonNo) ? DispMode.Add : DispMode.Edit;
            // Current datetime
            update.Now = Common.Common.GetCurrentTimestamp();
            // 注文番号
            string SaibanRenban = string.Empty;
            SaibanRenban = Common.Common.GetSaibanRenban(update.Now.Year.ToString(), "02");
            //SaibanRenban = update.Now.Year.ToString() + SaibanRenban;
            update.YoshiHanbaiChumonNo = SaibanRenban;
            // 合計金額
            update.YoshiHanbaiGokeiKingaku = !string.IsNullOrEmpty(totalKingakuTextBox.Text) ? Convert.ToDecimal(totalKingakuTextBox.Text) : 0;
            // 用紙販売ヘッダテーブル update
            update.YoshiHanbaiHdrTblDataTable = !string.IsNullOrEmpty(this._yoshiHanbaiChumonNo) ? CreateYoshiHanbaiHdrUpdate(this._hdrTable)
                : new YoshiHanbaiHdrTblDataSet.YoshiHanbaiHdrTblDataTable();
            // 販売先業者コード
            update.YoshiHanbaisakiGyoshaCd = gyosyaCdTextBox.Text;
            // 販売先担当者
            update.YoshiHanbaisakiTantosha = tantoTextBox.Text;
            // 支所コード
            update.YoshiHanbaiShishoCd = shishoNmComboBox.SelectedValue.ToString();
            // 販売日
            update.YoshiHanbaiDt = hanbaiDtDateTimePicker.Value;
            // 会員区分
            update.KaiinKbn = _gyoshaMst.Select(string.Format("GyoshaCd = '{0}'", gyosyaCdTextBox.Text))[0]["KaiinKbn"].ToString();
            // 用紙一覧グリッドビュー
            update.YoshiListDgv = yoshiListDataGridView;

            return update;
        }
Пример #26
0
 internal static void UpdateMetadataObjects(UpdateData[] updateDatas)
 {
     using (TransactionScope scope = new TransactionScope())
     {
         foreach (UpdateData item in updateDatas)
         {
             QuotationData.UpdateMetadataObject(item.MetadataType, item.ObjectId, item.FieldsAndValues);
         }
         scope.Complete();
     }
 }
Пример #27
0
 public UpdateFile()
 {
     SnakeBite = new UpdateData();
     Updater = new UpdateData();
 }
Пример #28
0
		protected void PlayActionSequence ( ArrayList p_actionSequence )
		{
			// check here if cueueble or action is uninteractibe.
			if( !this.IsInteractible() )
			{
				if( m_bEventIsCueable )
				{
					// Sanity check..
					//   1. Should not Add ActionSequence that is currently playing
					//	 2. Should not Add ActionSequence that is already in cue
					foreach( string action in p_actionSequence )
					{
						bool containsAction = false;
						
						foreach( string cuedAction in m_cuedActions )
						{
							if( action.Equals(cuedAction) )
								containsAction = true;
						}
						
						if( !containsAction ) { m_cuedActions.Add(action); }
						
#if DEBUG_CUEABLES
						if( containsAction ) Debug.LogError("Dragon::PlayActionSequence Dragon is not Interactible. adding "+action+" to cue.");
						else  				 Debug.LogError("Dragon::PlayActionSequence Dragon is not Interactible and already contains cueable "+action+" action.");
#else
						if( containsAction ) Log("Dragon::PlayActionSequence Dragon is not Interactible. adding "+action+" to cue.");
						else  				 Log("Dragon::PlayActionSequence Dragon is not Interactible and already contains cueable "+action+" action.");
#endif
					}
					return;
				}
				
#if DEBUG_CUEABLES
				Debug.LogError("Dragon::PlayActionSequence Cannot Play this Action because Action is not Interactibe.");
				//Debug.Break();
#else
				//Log("Dragon::PlayActionSequence Cannot Play this Action:"+MiniJSON.jsonEncode(p_actionSequence)+" because Action is not Interactibe.");
				Debug.LogWarning("Dragon::PlayActionSequence Cannot Play this Action:"+MiniJSON.jsonEncode(p_actionSequence)+" because Action is not Interactibe. \n");
#endif
				return;
			}
			
			// clear actions
			DragonAnimationQueue.getInstance().ClearAll();
			SoundManager.Instance.StopAnimationSound( PettingMain.Instance.HeadSoundContainer );
			SoundManager.Instance.StopAnimationSound( PettingMain.Instance.BodySoundContainer );
			SoundManager.Instance.StopAnimationSound( PettingMain.Instance.HeadAndBodySoundContainer );
			
			foreach( string action in p_actionSequence )
			{
				// Body Animations
				ArrayList bodyActionSequence = SequenceReader.GetInstance().ReadBodySequence(action);
				
				Log("----------- Playing Reaction:"+action+" -----------");
				
				//LogWarning(">>>>>>> Checking action: \""+action+"\"\n");
				if( bodyActionSequence != null )
				{
					// +KJ:06132013 Shared Parameter. this supports the same random value that a cue is sharing
					
					foreach( object actionData in bodyActionSequence )
					{
						ArrayList actionDataList = actionData as ArrayList;
						BodyData bodyData = new BodyData(); 
						
						bodyData.Action				= action;
						bodyData.Start 				= Utility.ParseToInt(actionDataList[0]);
						bodyData.ActionKey 			= actionDataList[1].ToString();
						bodyData.Duration			= float.Parse(actionDataList[2].ToString());
							
						if( actionDataList.Count > 3 )
						{
							bodyData.Param = actionDataList[3] as Hashtable;
						}
						
						bodyData.ExtractHashtableValues( bodyData.Param );
						bodyData.EventTrigger 	= this.FormulateEventTriggers( bodyData.Param );
						
						DragonAnimationQueue.getInstance().AddBodyCue( bodyData.GenerateHashtable() );
					}
				}
				
				// Head Animations
				ArrayList headActionSequence = SequenceReader.GetInstance().ReadHeadSequence(action);
				
				if( headActionSequence != null )
				{
					foreach( object actionData in headActionSequence )
					{
						ArrayList actionDataList = actionData as ArrayList;
						HeadData headData = new HeadData();
						
						headData.Action				= action;
						headData.Start 				= Utility.ParseToInt(actionDataList[0]);
						headData.ActionKey	 		= actionDataList[1].ToString();
						headData.Duration 			= float.Parse(actionDataList[2].ToString());
						
						if( actionDataList.Count > 3 )
						{
							headData.Param = actionDataList[3] as Hashtable;
						}
						
						headData.ExtractHashtableValues( headData.Param );
						headData.EventTrigger 		= this.FormulateEventTriggers( headData.Param );
						
						DragonAnimationQueue.getInstance().AddHeadCue( headData.GenerateHashtable() ) ;
					}
				}
				
				// Update Queue
				ArrayList updateActionQueue = SequenceReader.GetInstance().ReadUpdate(action);
				
				if( updateActionQueue != null )
				{
					foreach( object actionData in updateActionQueue )
					{
						ArrayList actionDataList = actionData as ArrayList;
						UpdateData updateData = new UpdateData();
						
						updateData.Action			= action;
						updateData.Start			= Utility.ParseToInt(actionDataList[0]);
						updateData.ActionKey 		= actionDataList[1].ToString();
						updateData.Duration 		= float.Parse(actionDataList[2].ToString());
						
						if( actionDataList.Count > 3 )
						{
                           updateData.Param = actionDataList[3] as Hashtable;
						}
						
						updateData.EventTrigger 	= this.FormulateEventTriggers( updateData.Param );
						
						DragonAnimationQueue.getInstance().AddUpdateCue( updateData.GenerateHashtable() );
					}
				}
				
				// Transition Queue
				ArrayList transitionQueue = SequenceReader.GetInstance().ReadTransform(action);
				
				if( transitionQueue != null )
				{
					foreach( object actionData in transitionQueue )
					{
						ArrayList actionDataList = actionData as ArrayList;
						TransformData transformData = new TransformData();
						
						transformData.Action		= action;
						transformData.Start 		= Utility.ParseToInt(actionDataList[0]);
						transformData.ActionKey 	= actionDataList[1].ToString();
						transformData.Duration 		= float.Parse(actionDataList[2].ToString());
										
						if( actionDataList.Count > 3 )
						{
							transformData.Param	= actionDataList[3] as Hashtable;
						}
						
						transformData.EventTrigger 	= this.FormulateEventTriggers( transformData.Param );
						
						DragonAnimationQueue.getInstance().AddTransformCue( transformData.GenerateHashtable() );
					}
				}
				
				ArrayList cameraQueue = SequenceReader.GetInstance().ReadCamera(action);
				
				if( cameraQueue != null )
				{
					foreach( object actionData in cameraQueue )
					{
						ArrayList actionDataList = actionData as ArrayList;
						CameraData cameraData = new CameraData();
						
						cameraData.Action			= action;
						cameraData.Start 			= Utility.ParseToInt(actionDataList[0]);
						cameraData.ActionKey 		= actionDataList[1].ToString();
						cameraData.Duration 		= float.Parse(actionDataList[2].ToString());
						
						if( actionDataList.Count > 3 )
						{
                            cameraData.Param = actionDataList[3] as Hashtable;
						}
						
						cameraData.EventTrigger = this.FormulateEventTriggers( cameraData.Param );
						
						DragonAnimationQueue.getInstance().AddCameraCue( cameraData.GenerateHashtable() );
					}
				}
				
				ArrayList eventQueue = SequenceReader.GetInstance().ReadEventTriggers(action);
				
				if( eventQueue != null )
				{
					foreach( object actionData in eventQueue )
					{
						ArrayList actionDataList = actionData as ArrayList;
						EventData eventData = new EventData();
						
						eventData.Action			= action;
						eventData.Start 			= Utility.ParseToInt(actionDataList[0]);
						eventData.ActionKey 		= actionDataList[1].ToString();
						eventData.Duration 			= float.Parse(actionDataList[2].ToString());
						
						if( actionDataList.Count > 3 )
						{
							eventData.Param = actionDataList[3] as Hashtable;
						}
						
						eventData.EventTrigger = this.FormulateEventTriggers( eventData.Param );
						
						DragonAnimationQueue.getInstance().AddEventCue( eventData.GenerateHashtable() );
					}
				}
				
				// + LA 072613
				ArrayList soundQueue = SequenceReader.GetInstance().ReadSounds(action);
				
				if( soundQueue != null )
				{
					foreach( object actionData in soundQueue )
					{
						ArrayList actionDataList = actionData as ArrayList;
						SoundData soundData = new SoundData();
						
						soundData.Action			= action;
						soundData.Start 			= Utility.ParseToInt(actionDataList[0]);
						soundData.ActionKey 		= actionDataList[1].ToString();
						soundData.Duration			= float.Parse(actionDataList[2].ToString());
						
						if( actionDataList.Count > 3 )
						{
							soundData.Param = actionDataList[3] as Hashtable;
						}
						
						soundData.EventTrigger = this.FormulateEventTriggers( soundData.Param );
						
						DragonAnimationQueue.getInstance().AddSoundCue( soundData.GenerateHashtable() );
					}
				}
				// - LA
			}
			
			DragonAnimationQueue.getInstance().PlayQueuedAnimations();
		}
Пример #29
0
    protected void lbtUpdate_Click(object sender, EventArgs e)
    {
        string sScript = "<script>";

        sScript += "var b = opener.parent.dhxLayout.cells(\"b\");";
        sScript += "b.attachURL(\"UserList.aspx?pbid=" + pbid + "\");";
        sScript += "window.close();";
        sScript += "</script>";

        Hashtable tbIn  = new Hashtable();
        string    isUse = (cbIsUse.Checked == true) ? "1" : "0";
        string    sex   = ((rbSex.Items[0].Selected == true) ? "1" : "0");
        string    pass  = ApplicationUtil.PasswordEncrypt(txtPass.Text);
        string    user  = txtUser.Text;

        tbIn.Add("User_Email", txtEmail.Text);
        tbIn.Add("pb_ID", ddlPb.SelectedValue);
        tbIn.Add("User_Name", txtName.Text);
        tbIn.Add("User_Tel", txtTel.Text);
        tbIn.Add("User_Mobile", txtMobile.Text);
        tbIn.Add("User_Address", txtAddress.Text);
        tbIn.Add("User_Info", txtInfo.Text);
        tbIn.Add("User_Sex", sex);
        tbIn.Add("User_Status", isUse);
        tbIn.Add("User_Pos", txtOrder.Text);
        tbIn.Add("User_Img", txtImg.Text.Replace("/upload", "upload"));
        tbIn.Add("User_Role", dllRole.SelectedValue);
        if (act == "add")
        {
            if (!FunctionDB.CheckUser(user))
            {
                tbIn.Add("Username", user);
                tbIn.Add("User_Pass", pass.ToString());
                bool _insert = UpdateData.Insert("tbl_User", tbIn);
                if (_insert)
                {
                    Hashtable tbNXUser = new Hashtable();
                    tbNXUser.Add("NhaxeId", ddlNhaXe.SelectedValue);
                    string    sql = "SELECT * FROM tbl_User WHERE UserName='******'";
                    DataTable dt  = UpdateData.UpdateBySql(sql).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        tbNXUser.Add("UserID", dt.Rows[0]["User_ID"].ToString());
                    }

                    bool _InsertNXUser = UpdateData.Insert("User_Nhaxe", tbNXUser);
                    if (_InsertNXUser)
                    {
                        FunctionDB.AddLog(Session["DepartID"].ToString(), Session["Username"].ToString(), "Thêm ", "Thành viên: " + user);
                    }
                }
            }
            else
            {
                lblMsg.Text = "Email của bạn đã tồn tại. Vui lòng chọn email khác!";
            }
        }
        if (act == "edit")
        {
            if (txtPass.Text != string.Empty)
            {
                tbIn.Add("User_Pass", pass.ToString());
            }
            bool _update = UpdateData.Update("tbl_User", tbIn, "User_ID=" + id);
            if (_update)
            {
                Hashtable tbNXUser = new Hashtable();
                tbNXUser.Add("NhaxeId", ddlNhaXe.SelectedValue);
                string    sql = "SELECT * FROM tbl_User WHERE UserName='******'";
                DataTable dt  = UpdateData.UpdateBySql(sql).Tables[0];

                bool _updateNXUser = UpdateData.Update("User_Nhaxe", tbNXUser, "UserID=" + dt.Rows[0]["User_ID"].ToString());
                if (_updateNXUser)
                {
                    FunctionDB.AddLog(Session["DepartID"].ToString(), Session["Username"].ToString(), "Sửa", "Thành viên: " + user);
                }
            }
        }
        Response.Write(sScript);
    }
Пример #30
0
        private void ProgressCallback(int workDone, int workTotal)
        {
            uint ticks = (uint)Environment.TickCount;
            if (ticks - m_lastUpdate < MIN_UPDATE_INTERVAL)
                return;
            m_lastUpdate = ticks;

            UpdateData data = new UpdateData();
            data.WorkDone = workDone;
            data.WorkTotal = workTotal;
            data.Label = string.Format("{0:N0} of {1:N0}", workDone, workTotal);
            m_progressForm.Invoke(new StateObjectCallback(ProgressUpdateCallback), new object[] {data});
        }
Пример #31
0
        public UpdateData ToUpdateData()
        {
            UpdateData data = new UpdateData();

            return(ToUpdateData(ref data));
        }
Пример #32
0
    protected void lbtUpdate_Click(object sender, EventArgs e)
    {
        string sScritp = "<script>";

        sScritp += "var b = opener.parent.dhxLayout.cells(\"b\");";
        sScritp += "b.attachURL(\"ContentList.aspx?TopicID=" + ddlModID.SelectedValue + "\");";
        sScritp += "window.close();";
        sScritp += "</script>";

        //string sql = "SELECT Tag_Url FROM tbl_Tag";
        //DataSet dsSQL = UpdateData.UpdateBySql(sql);
        //DataRowCollection rowsSQL = dsSQL.Tables[0].Rows;
        //ArrayList arrSQL = FunctionDB.GetRowAsArrayList(dsSQL, "Tag_Url");

        ////DataSet dsM = UpdateData.UpdateBySql("SELECT MAX(Content_ID) AS maxID FROM tbl_Content");
        ////DataRowCollection rowsM = dsM.Tables[0].Rows;
        ////int maxID = Convert.ToInt32(rowsM[0]["maxID"].ToString())+1;

        //string[] mID = txtTag.Text.Split(',');

        //for (int i = 0; i < mID.Length; i++)
        //{
        //    if (mID[i] != "")
        //    {
        //        string nTag = mID[i].ToString().Trim();
        //        string uTag = ApplicationUtil.GetTitle(mID[i].ToString().Trim());
        //        Hashtable tbTag = new Hashtable();
        //        //if (act == "add")
        //        //    tbTag.Add("Content_ID", maxID.ToString());
        //        tbTag.Add("Tag_Name", nTag);
        //        tbTag.Add("Tag_Url", uTag);
        //        if (arrSQL.Contains(uTag))
        //        {
        //            UpdateData.Update("tbl_Tag", tbTag, "Tag_Url='" + uTag + "'");
        //            UpdateData.UpdateBySql("UPDATE tbl_Tag SET Tag_Count=Tag_Count+1 WHERE Tag_Url='" + uTag + "'");
        //        }
        //        else
        //        {
        //            UpdateData.Insert("tbl_Tag", tbTag);
        //            arrSQL = FunctionDB.GetRowAsArrayList(dsSQL, "Tag_Url");
        //        }
        //    }
        //}
        string url   = txtURL.Text.Trim() == "" ? ApplicationUtil.GetTitle(txtName.Text.ToString()).ToLower() : txtURL.Text.Trim().ToLower();
        string title = txtTitle.Text.Trim() == "" ? txtName.Text.ToString() : txtTitle.Text.Trim();
        //string urlTag = txtTag.Text.Trim() == "" ? ApplicationUtil.GetTitle(txtKey.Text.ToString()).ToLower() : ApplicationUtil.GetTitle(txtTag.Text.Trim()).ToLower();
        Hashtable tbIn  = new Hashtable();
        string    isUse = (cbIsUse.Checked == true) ? "1" : "0";

        tbIn.Add("Mod_ID", ddlModID.SelectedValue);
        tbIn.Add("User_ID", Session["UserID"].ToString());
        tbIn.Add("Content_Name", txtName.Text);
        tbIn.Add("Content_Text", CKContent.Text);
        tbIn.Add("Content_Img", txtImg.Text.Replace("/upload", "upload"));
        //tbIn.Add("Content_URL", txtURL.Text);
        tbIn.Add("Content_Pos", txtPos.Text);
        tbIn.Add("Content_Status", isUse);
        tbIn.Add("Content_URL", url);
        tbIn.Add("Content_Title", title);
        tbIn.Add("Content_Key", txtKey.Text);
        tbIn.Add("Content_Des", txtMeta.Text);
        //tbIn.Add("Content_Tag", txtTag.Text);
        //tbIn.Add("Content_UrlTags", urlTag);
        if (act == "add")
        {
            tbIn.Add("lang", Session["lang"].ToString());
            bool _insert = UpdateData.Insert("tbl_Content", tbIn);
            if (_insert)
            {
                FunctionDB.AddLog(Session["DepartID"].ToString(), Session["Username"].ToString(), "Thêm ", "Bài: " + txtName.Text);
            }
        }
        if (act == "edit")
        {
            bool _update = UpdateData.Update("tbl_Content", tbIn, "Content_ID=" + id);
            if (_update)
            {
                FunctionDB.AddLog(Session["DepartID"].ToString(), Session["Username"].ToString(), "Sửa", "Bài: " + txtName.Text);
            }
        }
        Response.Write(sScritp);
    }
Пример #33
0
 public UpdateFile(string XmlFile)
 {
     SnakeBite = new UpdateData();
     Updater = new UpdateData();
     ReadXml(XmlFile);
 }
Пример #34
0
 private void OnBinaryReaderUpdateData(object sender, BinaryReaderArg e)
 {
     UpdateData?.Invoke(sender, e);
 }
Пример #35
0
    public bool ReadXmlFromInterweb(string URL)
    {
        WebClient xmlClient = new WebClient();
        try
        {
            string xmlData = xmlClient.DownloadString(URL);
            UpdateFile readXml;
            using (StringReader reader = new StringReader(xmlData))
            {
                XmlSerializer xml = new XmlSerializer(typeof(UpdateFile));
                readXml = (UpdateFile)xml.Deserialize(reader);
            }
            SnakeBite = readXml.SnakeBite;
            Updater = readXml.Updater;
            return true;
        }
        catch { }

        return false;
    }
Пример #36
0
 public abstract void ApplyEffect(UpdateData updateData);
Пример #37
0
 private void SetProgress(UpdateData data)
 {
 }
Пример #38
0
        private void Init(
            Dictionary<string, Stream> streamDict,
            SevenZipCompressor compressor, UpdateData updateData, bool directoryStructure)
        {
            _streams = new Stream[streamDict.Count];
            streamDict.Values.CopyTo(_streams, 0);
            _entries = new string[streamDict.Count];
            streamDict.Keys.CopyTo(_entries, 0);
            _actualFilesCount = streamDict.Count;
					//zero 11-oct-2014 - we want sequential streams only. length is unknown.
						//foreach (Stream str in _streams)
						//{
						//    if (str != null)
						//    {
						//        _bytesCount += str.Length;
						//    }
						//}
            CommonInit(compressor, updateData, directoryStructure);
        }
Пример #39
0
        public async Task <ActionResult> Update(UpdateData data)
        {
            var response = await _service.Update(data);

            return(Ok(response));
        }
Пример #40
0
 private void Core_DataUpdate()
 {
     UpdateData?.Invoke();
 }
Пример #41
0
        public static void UpdateStatus(string NodeName, string Data)
        {
            try
            {
                Form     form = Application.OpenForms["FormManual"];
                ComboBox portName;
                if (form == null)
                {
                    return;
                }

                portName = form.Controls.Find("Cb_LoadPortSelect", true).FirstOrDefault() as ComboBox;
                if (portName == null)
                {
                    return;
                }

                if (portName.InvokeRequired)
                {
                    UpdateData ph = new UpdateData(UpdateStatus);
                    portName.BeginInvoke(ph, NodeName, Data);
                }
                else
                {
                    if (portName.Text.Equals(NodeName))
                    {
                        Label STS = form.Controls.Find("LblStatus_A", true).FirstOrDefault() as Label;
                        if (STS == null)
                        {
                            return;
                        }
                        STS.Text = Data;

                        for (int i = 0; i < 19; i++)
                        {
                            string Idx   = (i + 1).ToString("00");
                            Label  StsLb = form.Controls.Find("Lab_StateCode_" + Idx + "_A", true).FirstOrDefault() as Label;
                            string Sts   = "";
                            switch (Idx)
                            {
                            case "01":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Normal";
                                    break;

                                case 'A':
                                    Sts = "Recoverable error";
                                    break;

                                case 'E':
                                    Sts = "Fatal error";
                                    break;
                                }
                                break;

                            case "02":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Online";
                                    break;

                                case '1':
                                    Sts = "Teaching";
                                    break;
                                }
                                break;

                            case "03":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Unexecuted";
                                    break;

                                case '1':
                                    Sts = "Executed";
                                    break;
                                }
                                break;

                            case "04":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Stopped";
                                    break;

                                case '1':
                                    Sts = "Operating";
                                    break;
                                }
                                break;

                            case "05":
                            case "06":
                                Sts = Data[i].ToString();
                                break;

                            case "07":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "None";
                                    break;

                                case '1':
                                    Sts = "Normal position";
                                    break;

                                case '2':
                                    Sts = "Error load";
                                    break;
                                }
                                break;

                            case "08":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Open";
                                    break;

                                case '1':
                                    Sts = "Close";
                                    break;

                                case '?':
                                    Sts = "Not defined";
                                    break;
                                }
                                break;

                            case "09":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Open";
                                    break;

                                case '1':
                                    Sts = "Close";
                                    break;

                                case '?':
                                    Sts = "Not defined";
                                    break;
                                }
                                break;

                            case "10":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "OFF";
                                    break;

                                case '1':
                                    Sts = "ON";
                                    break;
                                }
                                break;

                            case "11":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Open position";
                                    break;

                                case '1':
                                    Sts = "Close position";
                                    break;

                                case '?':
                                    Sts = "Not defined";
                                    break;
                                }
                                break;

                            case "12":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Blocked.";
                                    break;

                                case '1':
                                    Sts = "Unblocked.";
                                    break;
                                }
                                break;

                            case "13":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Up position";
                                    break;

                                case '1':
                                    Sts = "Down position";
                                    break;

                                case '2':
                                    Sts = "Start position";
                                    break;

                                case '3':
                                    Sts = "End position";
                                    break;

                                case '?':
                                    Sts = "Not defined";
                                    break;
                                }
                                break;

                            case "14":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Undock position";
                                    break;

                                case '1':
                                    Sts = "Dock position";
                                    break;

                                case '?':
                                    Sts = "Not defined";
                                    break;
                                }
                                break;

                            case "15":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Open";
                                    break;

                                case '1':
                                    Sts = "Close";
                                    break;

                                case '?':
                                    Sts = "Not defined";
                                    break;
                                }
                                break;

                            case "16":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Retract position";
                                    break;

                                case '1':
                                    Sts = "Mapping position";
                                    break;

                                case '?':
                                    Sts = "Not defined";
                                    break;
                                }
                                break;

                            case "17":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "ON";
                                    break;

                                case '1':
                                    Sts = "OFF";
                                    break;

                                case '?':
                                    Sts = "Not defined";
                                    break;
                                }
                                break;

                            case "18":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Unexecuted";
                                    break;

                                case '1':
                                    Sts = "Normal end";
                                    break;

                                case '2':
                                    Sts = "Abnormal end";
                                    break;
                                }
                                break;

                            case "19":
                                switch (Data[i])
                                {
                                case '0':
                                    Sts = "Enable";
                                    break;

                                case '1':
                                case '2':
                                case '3':
                                    Sts = "Disable";
                                    break;
                                }
                                break;
                            }

                            StsLb.Text = Sts;
                        }
                    }
                }
            }
            catch
            {
                logger.Error("UpdateStatus: Update fail.");
            }
        }
Пример #42
0
 /// <summary>
 /// Initializes a new instance of the ArchiveUpdateCallback class
 /// </summary>
 /// <param name="stream">The input stream</param>
 /// <param name="compressor">The owner of the callback</param>
 /// <param name="updateData">The compression parameters.</param>
 /// <param name="directoryStructure">Preserve directory structure.</param>
 public ArchiveUpdateCallback(
     Stream stream, SevenZipCompressor compressor, UpdateData updateData, bool directoryStructure)
 {
     Init(stream, compressor, updateData, directoryStructure);
 }
Пример #43
0
        public static void UpdateMapping(string NodeName, string Data)
        {
            try
            {
                Form     form = Application.OpenForms["FormManual"];
                ComboBox portName;
                if (form == null)
                {
                    return;
                }

                portName = form.Controls.Find("Cb_LoadPortSelect", true).FirstOrDefault() as ComboBox;
                if (portName == null)
                {
                    return;
                }

                if (portName.InvokeRequired)
                {
                    UpdateData ph = new UpdateData(UpdateMapping);
                    portName.BeginInvoke(ph, NodeName, Data);
                }
                else
                {
                    if (portName.Text.Equals(NodeName))
                    {
                        for (int i = Data.Length - 1; i >= 0; i--)
                        {
                            string Slot   = (i + 1).ToString("00");
                            Label  slotLb = form.Controls.Find("Lab_A_Slot_" + Slot, true).FirstOrDefault() as Label;

                            switch (Data[i])
                            {
                            case '0':
                                slotLb.Text      = "No wafer";
                                slotLb.BackColor = Color.Silver;
                                break;

                            case '1':
                                slotLb.Text      = "Wafer";
                                slotLb.BackColor = Color.Lime;
                                break;

                            case '2':
                                slotLb.Text      = "Crossed";
                                slotLb.BackColor = Color.Red;
                                break;

                            case '?':
                                slotLb.Text      = "Undefined";
                                slotLb.BackColor = Color.Silver;
                                break;

                            case 'W':
                                slotLb.Text      = "Overlapping";
                                slotLb.BackColor = Color.Red;
                                break;
                            }
                        }
                    }
                }
            }
            catch
            {
                logger.Error("UpdateControllerStatus: Update fail.");
            }
        }
Пример #44
0
 public void UpdateMetadataObjects(UpdateData[] updateDatas, Action<bool> NotifyResult)
 {
     this._ServiceProxy.BeginUpdateMetadataObjects(updateDatas, delegate(IAsyncResult ar)
     {
         bool result = this._ServiceProxy.EndUpdateMetadataObjects(ar);
         App.MainFrameWindow.Dispatcher.BeginInvoke((Action<bool>)delegate(bool success)
         {
             NotifyResult(success);
         }, result);
     }, null);
 }
Пример #45
0
 /// <summary>
 /// Initializes a new instance of the ArchiveUpdateCallback class
 /// </summary>
 /// <param name="files">Array of files to pack</param>
 /// <param name="rootLength">Common file names root length</param>
 /// <param name="password">The archive password</param>
 /// <param name="compressor">The owner of the callback</param>
 /// <param name="updateData">The compression parameters.</param>
 /// <param name="directoryStructure">Preserve directory structure.</param>
 public ArchiveUpdateCallback(
     FileInfo[] files, int rootLength, string password,
     SevenZipCompressor compressor, UpdateData updateData, bool directoryStructure)
     : base(password)
 {
     Init(files, rootLength, compressor, updateData, directoryStructure);
 }
 private void CommonInit()
 {
     DirectoryStructure = true;
     IncludeEmptyDirectories = true;
     CompressionLevel = CompressionLevel.Normal;
     CompressionMode = CompressionMode.Create;
     ZipEncryptionMethod = ZipEncryptionMethod.ZipCrypto;
     CustomParameters = new Dictionary<string, string>();
     _updateData = new UpdateData();
     DefaultItemName = "default";
 }
Пример #47
0
 /// <summary>
 /// Initializes a new instance of the ArchiveUpdateCallback class
 /// </summary>
 /// <param name="stream">The input stream</param>
 /// <param name="password">The archive password</param>
 /// <param name="compressor">The owner of the callback</param>
 /// <param name="updateData">The compression parameters.</param>
 /// <param name="directoryStructure">Preserve directory structure.</param>
 public ArchiveUpdateCallback(
     Stream stream, string password, SevenZipCompressor compressor, UpdateData updateData,
     bool directoryStructure)
     : base(password)
 {
     Init(stream, compressor, updateData, directoryStructure);
 }
        /// <summary>
        /// Modifies the existing archive (renames files or deletes them).
        /// </summary>
        /// <param name="archiveName">The archive file name.</param>
        /// <param name="newFileNames">New file names. Null value to delete the corresponding index.</param>
        /// <param name="password">The archive password.</param>
        public void ModifyArchive(string archiveName, Dictionary<int, string> newFileNames, string password 
#if CS4 
            = ""
#endif
        )
        {
            ClearExceptions();
            if (!SevenZipLibraryManager.ModifyCapable)
            {
                throw new SevenZipLibraryException("The specified 7zip native library does not support this method.");
            }
            if (!File.Exists(archiveName))
            {
                if (!ThrowException(null, new ArgumentException("The specified archive does not exist.", "archiveName")))
                {
                    return;
                }
            }
            if (newFileNames == null || newFileNames.Count == 0)
            {
                if (!ThrowException(null, new ArgumentException("Invalid new file names.", "newFileNames")))
                {
                    return;
                }
            }
            try
            {
                using (var extr = new SevenZipExtractor(archiveName))
                {
                    _updateData = new UpdateData();
                    var archiveData = new ArchiveFileInfo[extr.ArchiveFileData.Count];
                    extr.ArchiveFileData.CopyTo(archiveData, 0);
                    _updateData.ArchiveFileData = new List<ArchiveFileInfo>(archiveData);
                }
                _updateData.FileNamesToModify = newFileNames;
                _updateData.Mode = InternalCompressionMode.Modify;
            }
            catch (SevenZipException e)
            {
                if (!ThrowException(null, e))
                {
                    return;
                }
            }
            try
            {
                ISequentialOutStream sequentialArchiveStream;
                _compressingFilesOnDisk = true;
                using ((sequentialArchiveStream = GetOutStream(GetArchiveFileStream(archiveName))) as IDisposable)
                {
                    IInStream inArchiveStream;
                    _archiveName = archiveName;
                    using ((inArchiveStream = GetInStream()) as IDisposable)
                    {
                        IOutArchive outArchive;
                        // Create IInArchive, read it and convert to IOutArchive
                        SevenZipLibraryManager.LoadLibrary(
                            this, Formats.InForOutFormats[_archiveFormat]);
                        if ((outArchive = MakeOutArchive(inArchiveStream)) == null)
                        {
                            return;
                        }
                        using (ArchiveUpdateCallback auc = GetArchiveUpdateCallback(null, 0, password))
                        {
                            UInt32 deleteCount = 0;
                            if (_updateData.FileNamesToModify != null)
                            {
#if CS4 // System.Linq of C# 4 is great
                                deleteCount = (UInt32)_updateData.FileNamesToModify.Sum(
                                    pairDeleted => pairDeleted.Value == null ? 1 : 0);
#else
                                foreach(var pairDeleted in _updateData.FileNamesToModify)
                                {
                                    if (pairDeleted.Value == null)
                                    {
                                        deleteCount++;
                                    }
                                }
#endif
                            }
                            try
                            {
                                CheckedExecute(
                                    outArchive.UpdateItems(
                                        sequentialArchiveStream, _oldFilesCount - deleteCount, auc),
                                    SevenZipCompressionFailedException.DEFAULT_MESSAGE, auc);
                            }
                            finally
                            {
                                FreeCompressionCallback(auc);
                            }
                        }
                    }
                }
            }
            finally
            {
                SevenZipLibraryManager.FreeLibrary(this, Formats.InForOutFormats[_archiveFormat]);
                File.Delete(archiveName);
                FinalizeUpdate();
                _compressingFilesOnDisk = false;
                _updateData.FileNamesToModify = null;
                _updateData.ArchiveFileData = null;
                OnEvent(CompressionFinished, EventArgs.Empty, false);
            }
            ThrowUserException();
        }
Пример #49
0
 private void CommonInit(SevenZipCompressor compressor, UpdateData updateData, bool directoryStructure)
 {
     _compressor = compressor;
     _indexInArchive = updateData.FilesCount;
     _indexOffset = updateData.Mode != InternalCompressionMode.Append ? 0 : _indexInArchive;
     if (_compressor.ArchiveFormat == OutArchiveFormat.Zip)
     {
         _wrappersToDispose = new List<InStreamWrapper>();
     }
     _updateData = updateData;
     _directoryStructure = directoryStructure;
     DefaultItemName = "default";            
 }
 private UpdateData GetUpdateData()
 {
     if (_updateData.FileNamesToModify == null)
     {
         var updateData = new UpdateData { Mode = (InternalCompressionMode)((int)CompressionMode) };
         switch (CompressionMode)
         {
             case CompressionMode.Create:
                 updateData.FilesCount = UInt32.MaxValue;
                 break;
             case CompressionMode.Append:
                 updateData.FilesCount = _oldFilesCount;
                 break;
         }
         return updateData;
     }
     return _updateData;
 }
Пример #51
0
 private void Init(
     Stream stream, SevenZipCompressor compressor, UpdateData updateData, bool directoryStructure)
 {
     _fileStream = new InStreamWrapper(stream, false);
     _fileStream.BytesRead += IntEventArgsHandler;
     _actualFilesCount = 1;
     try
     {
         _bytesCount = stream.Length;
     }
     catch (NotSupportedException)
     {
         _bytesCount = -1;
     }
     try
     {
         stream.Seek(0, SeekOrigin.Begin);
     }
     catch (NotSupportedException)
     {
         _bytesCount = -1;
     }
     CommonInit(compressor, updateData, directoryStructure);
 }
Пример #52
0
        public void Update(UpdateData updateData)
        {
            for (int i = 0; i < backingTorrents.Count; ++i)
            {
                var item = backingTorrents[i];
                if (updateData.DeletedTorrents.Contains(item.Id))
                {
                    var torrent = backingTorrents[i--];
                    backingTorrents.Remove(torrent);
                    continue;
                }
                else if (updateData.UpdatedTorrents.ContainsKey(item.Id))
                {
                    item.Update(updateData.UpdatedTorrents[item.Id], updateData.ServerStats.SpeedUnits, updateData.ServerStats.SizeUnits);
                    continue;
                }
            }

            foreach (var torrent in updateData.NewTorrents)
            {
                var torrentVM = new TorrentViewModel(torrent, _eventAggregator, _errorTracker, updateData.ServerStats.SpeedUnits, updateData.ServerStats.SizeUnits);
                backingTorrents.Add(torrentVM);
            }

            UpdateMenu();
            FilterList.Update(backingTorrents);
            Server.Update(updateData.ServerStats);
        }
        protected override void Refresh(UpdateData updateConfig, out int lastStartIndex)
        {
            if (updateConfig.keepPaddingType == EKeepPaddingType.END)
            {
                var targetRenderStartPos = (ContentHeight - updateConfig.tempLastContentRect.height) + contentRenderStartPos;
                var temp = content.localPosition;
                temp.y = targetRenderStartPos;
                content.localPosition = temp;
            }

            contentRenderStartPos = content.localPosition.y;
            if (contentRenderStartPos < 0)
            {
                contentRenderStartPos = 0;
            }
            else if (contentRenderStartPos > ContentHeight - viewportSize.y)
            {
                contentRenderStartPos = ContentHeight - viewportSize.y;
            }

            int   dataIdx;
            float startPos = layout.paddingTop;

            for (dataIdx = 0; dataIdx < _itemModels.Count; dataIdx++)
            {
                var dataBottom = startPos + _itemModels[dataIdx].height;
                if (dataBottom >= contentRenderStartPos)
                {
                    //就是我了
                    break;
                }

                startPos = dataBottom + layout.gap;
            }

            lastStartIndex = dataIdx;

            //显示的内容刚好大于这个值即可
            float contentHeightLimit = viewportSize.y;
            float itemY = -startPos;

            /// <summary>
            /// 最后一次显示的Item的缓存
            /// </summary>
            Dictionary <ScrollListItemModel, ScrollListItem> lastShowingItems = new Dictionary <ScrollListItemModel, ScrollListItem>(_showingItems);

            _showingItems.Clear();

            while (dataIdx < _itemModels.Count)
            {
                var model = _itemModels[dataIdx];

                ScrollListItem item = CreateItem(model, dataIdx, lastShowingItems);
                //item.gameObject.name += $"_{_itemModels[dataIdx].height}";

                _showingItems[model] = item;

                var pos = Vector3.zero;
                pos.y = itemY;
                item.rectTransform.localPosition = pos;
                //下一个item的Y坐标
                itemY -= (item.height + layout.gap);
                //下一个item的索引
                dataIdx++;

                if (-contentRenderStartPos - itemY >= contentHeightLimit)
                {
                    break;
                }
            }

            //回收没有使用的item
            RecycleUselessItems(lastShowingItems);
        }
        private void OK_Click(object sender, RoutedEventArgs e)
        {
            if(string.IsNullOrEmpty(this._Relation.SourceSymbol))
            {
                this._HintMessage.ShowError("Source Symbol can not be empty.");
                this.SourceSymbolBox.Focus();
                return;
            }
            if(Validation.GetHasError(this.SwitchTimeoutBox))
            {
                this._HintMessage.ShowError("Please provide a number for SwitchTimeout.");
                this.SwitchTimeoutBox.Focus();
                return;
            }
            if (this._Relation.SwitchTimeout < 5 || this._Relation.SwitchTimeout > 600)
            {
                this._HintMessage.ShowError("SwitchTimeout must between 5 and 600.");
                this.SwitchTimeoutBox.Focus();
                return;
            }

            if(!this.IsValid(this))
            {
                this._HintMessage.ShowError("Please provide appropriate data.");
                return;
            }

            if (this._EditMode == EditMode.AddNew)
            {
                ConsoleClient.Instance.AddMetadataObject(this._Relation, delegate(int relationId)
                {
                    this.Dispatcher.BeginInvoke((Action<int>)delegate(int id)
                    {
                        if (id != 0)
                        {
                            this._Relation.Id = id;
                            VmQuotationManager.Instance.Add(this._Relation.Clone());
                            this.BindSourcesComboBox();
                            this.CancelButton.Content = "Close";
                            this._HintMessage.ShowMessage("Add Instrument Source Relation successfully.");
                        }
                        else
                        {
                            this._HintMessage.ShowError("Add Instrument Source Relation failed.");
                        }
                    }, relationId);
                });
            }
            else
            {
                Dictionary<string, object> fieldAndValues = new Dictionary<string, object>();
                if (this._originRelation.SourceSymbol != this._Relation.SourceSymbol) fieldAndValues.Add(FieldSR.SourceSymbol, this._Relation.SourceSymbol);
                if (this._originRelation.Inverted != this._Relation.Inverted) fieldAndValues.Add(FieldSR.Inverted, this._Relation.Inverted);
                if (this._originRelation.IsDefault != this._Relation.IsDefault) fieldAndValues.Add(FieldSR.IsDefault, this._Relation.IsDefault);
                if (this._originRelation.Priority != this._Relation.Priority) fieldAndValues.Add(FieldSR.Priority, this._Relation.Priority);
                if (this._originRelation.SwitchTimeout != this._Relation.SwitchTimeout) fieldAndValues.Add(FieldSR.SwitchTimeout, this._Relation.SwitchTimeout);
                if (this._originRelation.AdjustPoints != this._Relation.AdjustPoints) fieldAndValues.Add(FieldSR.AdjustPoints, this._Relation.AdjustPoints);
                if (this._originRelation.AdjustIncrement != this._Relation.AdjustIncrement) fieldAndValues.Add(FieldSR.AdjustIncrement, this._Relation.AdjustIncrement);
                if (fieldAndValues.Count > 0)
                {
                    VmInstrumentSourceRelation currentDefaultRelation = this._originRelation.vmInstrument.SourceRelations.SingleOrDefault(r => r.IsDefault == true);
                    if (fieldAndValues.ContainsKey(FieldSR.IsDefault) && this._Relation.IsDefault && currentDefaultRelation != null)
                    {
                        // 将修改的Relation的IsDefault设置为true,且Instrument下有一个其它的Relation的IsDefault为true时:
                        Dictionary<string, object> isDefaultfieldAndValues = new Dictionary<string, object>();
                        isDefaultfieldAndValues.Add(FieldSR.IsDefault, false);
                        UpdateData isDefaultUpdateData = new UpdateData
                        {
                            MetadataType = MetadataType.InstrumentSourceRelation,
                            ObjectId = currentDefaultRelation.Id,
                            FieldsAndValues = isDefaultfieldAndValues
                        };

                        UpdateData relationUpdateData = new UpdateData
                        {
                            MetadataType = MetadataType.InstrumentSourceRelation,
                            ObjectId = this._Relation.Id,
                            FieldsAndValues = fieldAndValues
                        };

                        ConsoleClient.Instance.UpdateMetadataObjects(new UpdateData[] { relationUpdateData, isDefaultUpdateData }, delegate(bool success)
                        {
                            this.Dispatcher.BeginInvoke((Action<bool>)delegate(bool updated) {
                                if(updated)
                                {
                                    this._originRelation.ApplyChangeToUI(fieldAndValues);
                                    currentDefaultRelation.ApplyChangeToUI(isDefaultfieldAndValues);
                                    this.CancelButton.Content = "Close";
                                    this._HintMessage.ShowMessage("Update Instrument Source Relation successfully.");
                                }
                                else
                                {
                                    this._HintMessage.ShowError("Update Instrument Source Relation failed.");
                                }
                            }, success);
                        });

                    }
                    else
                    {
                        ConsoleClient.Instance.UpdateMetadataObject(MetadataType.InstrumentSourceRelation, this._Relation.Id, fieldAndValues, delegate(bool success)
                        {
                            this.Dispatcher.BeginInvoke((Action<bool>)delegate(bool updated)
                            {
                                if (updated)
                                {
                                    this._originRelation.ApplyChangeToUI(fieldAndValues);
                                    this.CancelButton.Content = "Close";
                                    this._HintMessage.ShowMessage("Update Instrument Source Relation successfully.");
                                }
                                else
                                {
                                    this._HintMessage.ShowError("Update Instrument Source Relation failed.");
                                }
                            }, success);
                        });
                    }
                }
                else
                {
                    this._HintMessage.ShowError("Nothing changed.");
                }
            }
        }