Пример #1
0
        new public void Load(enuEdit enuNew_Edit, DataRow drEdit)
        {
            //this.drEdit = drEdit;
            //this.enuNew_Edit = enuNew_Edit;
            //this.Tag = (char)enuNew_Edit + ", " + this.Tag;
            this.cboFile_Type.DataSource    = SQLExec.ExecuteReturnDt("SELECT DISTINCT 'DOC' AS File_Type UNION ALL SELECT DISTINCT 'IMG' AS File_Type UNION ALL SELECT DISTINCT 'XLS' AS File_Type UNION ALL SELECT DISTINCT 'EXE' AS File_Type ");
            this.cboFile_Type.DisplayMember = "File_Type";
            this.cboFile_Type.ValueMember   = "File_Type";
            //Common.ScaterMemvar(this, ref drEdit);

            //this.ShowDialog();
            this.drEdit      = drEdit;
            this.enuNew_Edit = enuNew_Edit;
            this.Tag         = ((char)((ushort)enuNew_Edit)) + ", " + this.Tag;


            if (enuNew_Edit == enuEdit.New)
            {
                Ident00              = 0;
                drEdit["Ident00"]    = 0;
                drEdit["Duyet"]      = 0;
                drEdit["IsZaloSend"] = 0;
                drEdit["Nguoi_Ky"]   = "";
                this.objFileContent  = ImageToByte(picImage.Image);
            }
            Common.ScaterMemvar(this, ref drEdit);
            Ident00 = (int)drEdit["Ident00"];

            if (enuNew_Edit == enuEdit.Edit)
            {
                //Edit: Disable Ma_Vt
                txtFile_Id.Enabled = false;

                this.cboFile_Type.Enabled = false;
                this.objFileContent       = SaveZaloResource.LoadResource(Ident00);
                if (this.objFileContent != null)
                {
                    using (Stream stream = new MemoryStream())
                    {
                        new BinaryFormatter().Serialize(stream, this.objFileContent);
                        this.lblSize.Text = "(" + stream.Length.ToString() + ")";
                    }
                }


                if ((bool)(drEdit["IsZaloSend"]))
                {
                    btgAccept.btAccept.Enabled = false;
                    btUpLoad.Enabled           = false;
                }
            }
            this.ShowImage();
            this.LoadDicName();
            this.ShowDialog();
        }
Пример #2
0
        private bool Save()
        {
            Common.GatherMemvar(this, ref this.drEdit);
            this.drEdit["File_Tag"] = this.lbtFile_Tag.Text;


            if (!this.FormCheckValid())
            {
                return(false);
            }
            //int Ident00 =  Convert.ToInt32(this.drEdit["Ident00"]);
            DataTable dtupdate = SaveZaloResource.SaveZaloResoure(Ident00, this.drEdit["File_Id"].ToString(), this.drEdit["File_Name"].ToString(), this.drEdit["Ma_Nhom"].ToString(), this.drEdit["Catalog"].ToString(),
                                                                  this.drEdit["File_Type"].ToString(), this.drEdit["File_Tag"].ToString(), this.objFileContent, (DateTime)this.drEdit["Ngay_Ky"], this.drEdit["Nguoi_Ky"].ToString(), (bool)this.drEdit["Duyet"]
                                                                  , this.drEdit["Description"].ToString(), this.drEdit["ZALOLINK"].ToString(), this.drEdit["MA_KV_LIST"].ToString(), this.drEdit["MA_BP_LIST"].ToString(), this.drEdit["Tag_List"].ToString());

            if (dtupdate.Rows.Count > 0)
            {
                Ident00 = Convert.ToInt32(this.drEdit["Ident00"]);
                this.drEdit["Ident00"]        = dtupdate.Rows[0]["Ident00"];
                this.drEdit["File_Id"]        = dtupdate.Rows[0]["File_Id"];
                this.drEdit["File_Id_Parent"] = dtupdate.Rows[0]["File_Id_Parent"];
            }
            else
            {
                return(false);
            }
            //if (Ident00 != 0)
            //{

            //}
            //if (DataTool.SQLCheckExist("SYSRESOURCES", "File_Id", this.drEdit["File_Id"].ToString()) && enuNew_Edit == enuEdit.New)
            //{
            //    EpointMessage.MsgOk("Mã tập tin đã tồn tại !");
            //    return false;
            //}

            //if (!SQLExec.Execute("Sp_UpdateResource", drEdit, CommandType.StoredProcedure))
            //{
            //    return false;
            //}

            //if (drEdit["File_Type"].ToString() == "IMG")
            //    SaveResource.SaveImage(this.drEdit["File_Id"].ToString(), this.drEdit["File_Name"].ToString(), this.drEdit["Ma_Nhom"].ToString(), this.drEdit["Catalog"].ToString(), this.drEdit["File_Type"].ToString(), this.drEdit["File_Tag"].ToString(), picImage, (DateTime)this.drEdit["Ngay_Ky"], this.drEdit["Nguoi_Ky"].ToString(), (bool)this.drEdit["Duyet"]);
            //else
            //    SaveResource.Save(this.drEdit["File_Id"].ToString(), this.drEdit["File_Name"].ToString(), this.drEdit["Ma_Nhom"].ToString(), this.drEdit["Catalog"].ToString(), this.drEdit["File_Type"].ToString(), this.drEdit["File_Tag"].ToString(), this.objFileContent, (DateTime)this.drEdit["Ngay_Ky"], this.drEdit["Nguoi_Ky"].ToString(), (bool)this.drEdit["Duyet"]);

            return(true);
        }