Exemple #1
0
        private void lblDownTemplae_Click(object sender, EventArgs e)
        {
            //下载模本(从服务端下载)
            string lang = System.Threading.Thread.CurrentThread.CurrentCulture.Name;
            string file = typeof(FormSendEmail).Name + ".xlsx";
            FolderBrowserDialog folderDialog = new FolderBrowserDialog();

            if (folderDialog.ShowDialog() == DialogResult.OK)
            { //从服务器下载模本文件
                GSSModel.TemplateFile tem = new GSSModel.TemplateFile()
                {
                    TemplateName = file,
                    SystemLang   = lang
                };
                GSSCSFrameWork.MsgStruts response = Client.DownloadTemplateFile(tem);
                if (response.msgsendstate != GSSCSFrameWork.msgSendState.None)
                {
                    FileStream fs = new FileStream(folderDialog.SelectedPath + "//" + file, FileMode.Create, FileAccess.Write);
                    fs.Write(response.Data, 0, response.Data.Length);
                    fs.Close();
                }
                else
                {
                    string msg = DataSerialize.GetObjectFromByte(response.Data) as string;
                    MsgBox.Show(msg, LanguageResource.Language.Tip_Tip, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        /// <summary>
        /// 增加工单
        /// </summary>
        /// <param name="task"></param>
        public MsgStruts DownloadTemplateFile(GSSModel.TemplateFile task)
        {
            MsgStruts msg = new MsgStruts();

            msg.command      = msgCommand.DownloadTemplateFile;
            msg.msgtype      = msgType.SendText;
            msg.msgsendstate = msgSendState.single;
            msg.Data         = DataSerialize.GetByteFromObject(task);
            MsgStruts msgb = _tcpcli.SendAndBack(msg);

            return(msgb);
        }