Ejemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);


            if (!this.blNewFlag)
            {
                Model.Info_xls_doc info = modelObj as Model.Info_xls_doc;
                this.SetDataBind(info);
            }
        }
Ejemplo n.º 2
0
        void ComboBox_SelectedValueChanged(object sender, EventArgs e)
        {
            //long tmpId = (long)cmbBillType.ComboBox.SelectedValue;
            Model.Info_xls_doc info = cmbBillType.ComboBox.SelectedItem as Model.Info_xls_doc;
            if (info == null)
            {
                return;
            }

            this.reoGridControl1.Reset();
            this.reoGridControl1.Load(new MemoryStream(info.Tmp_Body), unvell.ReoGrid.IO.FileFormat.Excel2007);
            // set entire worksheet read-only
            //this.reoGridControl1.CurrentWorksheet.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_Readonly, true);
            List <string> inputColList = new List <string>();

            string[] inputCols = info.Input_Cols.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            if (inputCols != null)
            {
                foreach (var v in inputCols)
                {
                    string name      = v.Substring(0, v.IndexOf("."));
                    string rows      = v.Substring(v.IndexOf(".") + 1);
                    string begingRow = rows.Substring(0, rows.IndexOf(":"));
                    string endRow    = rows.Substring(rows.IndexOf(":") + 1);
                    int    bRow      = int.Parse(begingRow);
                    int    eRow      = int.Parse(endRow);
                    for (int i = bRow; i <= eRow; i++)
                    {
                        string columnName = name + i;
                        inputColList.Add(columnName);
                    }
                }

                for (int col = 0; col < info.Column_Count; col++)
                {
                    for (int row = 0; row < info.Row_Count; row++)
                    {
                        string columnName = unvell.ReoGrid.RGUtility.ToAddress(row, col, true);
                        bool   isReadOnly = true;
                        if (inputColList.Contains(columnName))
                        {
                            isReadOnly = false;
                        }

                        this.reoGridControl1.CurrentWorksheet.Cells[row, col].IsReadOnly = isReadOnly;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            if (mDataGridNvl.CurrentRow == null)
            {
                return;
            }
            Model.Info_xls_doc info = mDataGridNvl.GetCurrentEntity() as Model.Info_xls_doc;

            FmXlsDocInfo fmTmpXlsInfo = new FmXlsDocInfo(info);

            fmTmpXlsInfo.SelectValue += (obj) =>
            {
                LoadAllTmp();
            };
            fmTmpXlsInfo.ShowDialog();
        }
Ejemplo n.º 4
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            if (mDataGridNvl.CurrentRow == null)
            {
                return;
            }
            Model.Info_xls_doc info = mDataGridNvl.GetCurrentEntity() as Model.Info_xls_doc;

            string msg = string.Format("确定删除:{0}信息?", info.Tmp_Name);

            if (Miles.Framework.UI.Function.Dialog.ShowQuestionYesNo(msg))
            {
                if (manager.Remove(info))
                {
                    LoadAllTmp();
                }
            }
        }
Ejemplo n.º 5
0
        private void BtnImport_Click(object sender, EventArgs e)
        {
            if (mDataGridNvl.CurrentRow == null)
            {
                return;
            }
            Model.Info_xls_doc info = mDataGridNvl.GetCurrentEntity() as Model.Info_xls_doc;

            OpenFileDialog dialog = new OpenFileDialog();

            //dialog.Multiselect = true;//该值确定是否可以选择多个文件
            dialog.Title  = "请选择文件";
            dialog.Filter = @"模板文件|*.xlsx";
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.reoGridControl1.Reset();
                reoGridControl1.Load(dialog.FileName, unvell.ReoGrid.IO.FileFormat.Excel2007);
            }
        }
Ejemplo n.º 6
0
        private void MDataGridNvl_CurrentRowChanged(object sender, EventArgs e)
        {
            reoGridControl1.Reset();

            Model.Info_xls_doc info = mDataGridNvl.GetCurrentEntity() as Model.Info_xls_doc;
            if (info == null)
            {
                return;
            }

            //if (info.Tmp_Body == null)
            //{
            //    info.Tmp_Body = manager.GetTheTmpBody(info.Tmp_Id);
            //}

            if (info.Tmp_Body != null)
            {
                reoGridControl1.Load(new MemoryStream(info.Tmp_Body), unvell.ReoGrid.IO.FileFormat.Excel2007);
            }
        }
Ejemplo n.º 7
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (mDataGridNvl.CurrentRow == null)
            {
                return;
            }
            Model.Info_xls_doc info = mDataGridNvl.GetCurrentEntity() as Model.Info_xls_doc;

            using (MemoryStream stream = new MemoryStream())
            {
                reoGridControl1.Save(stream, unvell.ReoGrid.IO.FileFormat.Excel2007);
                info.Tmp_Body = stream.ToArray();
            }

            if (manager.SaveBody(info))
            {
                LoadAllTmp();
                Miles.Framework.UI.Function.MForm.SetToolStripButtonTip(this.btnSave, "保存成功");
            }
        }
Ejemplo n.º 8
0
        protected override bool BtnOkClick()
        {
            Dictionary <Control, string> dicEmptyCtrs = this.GetValidEmptyCtrs();

            if (dicEmptyCtrs.Count > 0)
            {
                foreach (var ctr in dicEmptyCtrs.Keys)
                {
                    Miles.Framework.UI.Function.MForm.SetToolTip(ctr, dicEmptyCtrs[ctr], 1000);
                    return(false);
                }
            }

            Model.Info_xls_doc old  = modelObj as Model.Info_xls_doc;
            Model.Info_xls_doc info = old != null?this.GetDataBind <Model.Info_xls_doc>(old) : this.GetDataBind <Model.Info_xls_doc>();


            if (this.blNewFlag)
            {
                //info.Part_Id = Miles.Coro.Common.Utils.GuidToInt64();
                if (!manager.Add(info))
                {
                    return(false);
                }
            }
            else
            {
                if (!manager.UpdateInfo(info))
                {
                    return(false);
                }
            }

            this.DoSelectValueEvent(info);

            return(true);
        }
Ejemplo n.º 9
0
 public FmXlsDocInfo(Model.Info_xls_doc info)
     : base(info)
 {
     InitializeComponent();
 }