예제 #1
1
        public bool GenericEditEvent(IEditable _geditForm, BindingSource actualEvents, bool isNew = false)
        {
            ulog = UserLog.Instance;

            try
            {
                DataRowView eventDataRowView;
                eventDataRowView = (isNew == false) ? (DataRowView)actualEvents.Current : (DataRowView)actualEvents.AddNew();
                if (eventDataRowView == null)
                    throw new Exception("Нет записей для редактирования.");

                using (IEditable editForm = _geditForm)
                {
                    if (editForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        actualEvents.EndEdit();

                        DateTime dt;
                        string _edit = (isNew == false) ? "Изменено " : "Добавлено ";

                        if (eventDataRowView.Row.Table.Columns.Contains("ActionDate"))
                        {
                            dt = Convert.ToDateTime(eventDataRowView["ActionDate"]);
                            _edit += "мероприятие на " + dt.ToShortDateString() + ".";
                        }
                        else if (eventDataRowView.Row.Table.Columns.Contains("DayID"))
                        {
                            _edit += "календарное мероприятие. День недели: " + DatabaseConstant.LocalDayOfWeek[Convert.ToInt32(eventDataRowView["DayID"]) - 1] + ".";
                        }

                        ulog.Message(_edit, UserLogMessageLevel.Warning);
                        return true;
                    }
                    else
                    {
                        actualEvents.CancelEdit();
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {
                ulog.Message(ex.Message, UserLogMessageLevel.Error);
                return false;
            }
        }
예제 #2
0
        /// <summary>
        /// 选择导入数据
        /// </summary>
        /// <param name="dsDetail">导入目标数据源</param>
        /// <param name="reportno">查询编号</param>
        /// <param name="fields">导入的字段,e.g: a=b,c=d 其中a和c为目标数据源中的字段,b和d为选择数据源中的字段,多个用英文逗号“,”进行分割</param>
        /// <param name="where">选择数据源的过滤条件</param>
        /// <param name="isautoselect">是否默认选中所有数据</param>
        public void SelectData(BindingSource dsDetail, string reportno, string fields, string where,bool isautoselect)
        {
            //数据选择窗体
            frmCommSelectForm frm = new frmCommSelectForm(reportno, where, isautoselect);
            frm.StartPosition = FormStartPosition.CenterParent;
            frm.WindowState = FormWindowState.Normal;
            frm.ReportNo = reportno;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                //解析需要设置值的字段
                string[] fieldstring = Public.GetSplitString(fields, ",");
                List<string> ValueFields = new List<string>();
                List<string> DataFields = new List<string>();
                foreach (string s in fieldstring)
                {
                    string[] ss = Public.GetSplitString(s, "=");
                    DataFields.Add(ss[0]);
                    ValueFields.Add(ss[1]);
                }

                //插入数据
                foreach (DataRow dr in frm.ResultData)
                {
                    dsDetail.AddNew();
                    for (int i = 0; i < DataFields.Count; i++)
                    {
                        ((DataRowView)dsDetail.Current).Row[DataFields[i]] = dr[ValueFields[i]];
                    }
                    dsDetail.EndEdit();
                }
            }
        }
예제 #3
0
        private void AddEscada(int code)
        {
            System.Windows.Forms.BindingSource escadaSucesso;
            Igrejafont10DataSetTableAdapters.EscadaSucessoTableAdapter escadaTableAdapter;
            escadaSucesso = new System.Windows.Forms.BindingSource(this.components);
            ((System.ComponentModel.ISupportInitialize)(escadaSucesso)).BeginInit();
            escadaSucesso.DataMember = "EscadaSucesso";
            escadaSucesso.DataSource = this.igrejafont10DataSet;
            ((System.ComponentModel.ISupportInitialize)(escadaSucesso)).EndInit();
            escadaTableAdapter = new GerenciamentoCelulas.Igrejafont10DataSetTableAdapters.EscadaSucessoTableAdapter();
            escadaTableAdapter.ClearBeforeFill = true;

            GerenciamentoCelulas.Igrejafont10DataSet.EscadaSucessoRow newmember = igrejafont10DataSet.EscadaSucesso.NewEscadaSucessoRow();

            newmember.Codigo         = code;
            newmember.OracaoEntrega  = "";
            newmember.DecisaoIgreja  = "";
            newmember.Discipulado    = "";
            newmember.PreEncontro    = "";
            newmember.Encontro       = "";
            newmember.PosEncontro    = "";
            newmember.Encontreiro    = "";
            newmember.Batismo        = "";
            newmember.EM             = "";
            newmember.DizimosOfertas = "";
            newmember.CasamentoLegal = "";
            newmember.TADEL          = "";
            newmember.MDA2           = "";
            newmember.TLC            = "";
            newmember.CoLider        = "";

            igrejafont10DataSet.EscadaSucesso.Rows.Add(newmember);
            escadaSucesso.EndEdit();
            escadaTableAdapter.Update(igrejafont10DataSet.EscadaSucesso);
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.BindingSource membros;
            Igrejafont10DataSetTableAdapters.Membros1TableAdapter membrosTableAdapter1;
            membros = new System.Windows.Forms.BindingSource(this.components);
            ((System.ComponentModel.ISupportInitialize)(membros)).BeginInit();
            membros.DataMember = "Membros1";
            membros.DataSource = this.igrejafont10DataSet;
            ((System.ComponentModel.ISupportInitialize)(membros)).EndInit();
            membrosTableAdapter1 = new GerenciamentoCelulas.Igrejafont10DataSetTableAdapters.Membros1TableAdapter();
            membrosTableAdapter1.ClearBeforeFill = true;

            membrosTableAdapter1.Fill(igrejafont10DataSet.Membros1);

            membros.Position = membros.Find("Codigo", dataGridView.CurrentRow.Cells[0].Value.ToString());
            DataRowView row = (DataRowView)membros.Current;

            row["Celula"] = "0";

            membros.EndEdit();
            membrosTableAdapter1.Update(igrejafont10DataSet.Membros1);

            membrosTableAdapter.FillBy(igrejafont10DataSet.Membros);

            FiltraMembros();
        }
        private void SaveDate()
        {
            gv_RoleFormSet.CloseEditor();
            BindingSource binding = new BindingSource();
            binding.DataSource = ((DataTable)gc_RoleFormSet.DataSource);
            gc_RoleFormSet.DataSource = binding;
            binding.EndEdit();
            if (DT.GetChanges() != null)
            {

                ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DT.GetChanges(), "Sys_RoleFormSet");
            }
            LoadData();
        }
예제 #6
0
        private void removeMemberButton_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow.Cells[0].Value.ToString().Length > 0)
            {
                DialogResult result = MessageBox.Show("Deseja remover o membro: " + dataGridView.CurrentRow.Cells[1].Value.ToString(), "Pergunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    try
                    {
                        System.Windows.Forms.BindingSource escadaSucesso;
                        Igrejafont10DataSetTableAdapters.EscadaSucessoTableAdapter escadaTableAdapter;
                        escadaSucesso = new System.Windows.Forms.BindingSource(this.components);
                        ((System.ComponentModel.ISupportInitialize)(escadaSucesso)).BeginInit();
                        escadaSucesso.DataMember = "EscadaSucesso";
                        escadaSucesso.DataSource = this.igrejafont10DataSet;
                        ((System.ComponentModel.ISupportInitialize)(escadaSucesso)).EndInit();
                        escadaTableAdapter = new GerenciamentoCelulas.Igrejafont10DataSetTableAdapters.EscadaSucessoTableAdapter();
                        escadaTableAdapter.ClearBeforeFill = true;
                        escadaTableAdapter.Fill(this.igrejafont10DataSet.EscadaSucesso);

                        membrosBindingSource1.RemoveAt(membrosBindingSource1.Find("Codigo", dataGridView.CurrentRow.Cells[0].Value.ToString()));
                        escadaSucesso.RemoveAt(escadaSucesso.Find("Codigo", dataGridView.CurrentRow.Cells[0].Value.ToString()));
                        membrosBindingSource1.EndEdit();
                        membrosTableAdapter1.Update(igrejafont10DataSet.Membros1);
                        escadaSucesso.EndEdit();
                        escadaTableAdapter.Update(igrejafont10DataSet.EscadaSucesso);

                        membrosTableAdapter.FillBy(igrejafont10DataSet.Membros);
                        cellMembersLabel.Text = dataGridView.RowCount.ToString();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Update failed /n" + ex.ToString());
                    }
                }
            }
            else
            {
                MessageBox.Show("Selecione um membro para ser removido.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #7
0
        private void RedeWindowSearchMember_Click(object sender, EventArgs e)
        {
            if (celulaComboBox.SelectedValue != null)
            {
                GerenciamentoCelulas.Forms.Membros.MembroSearch search = new Membros.MembroSearch(igrejaComboBox.Text);

                search.ShowDialog();

                int newMember = search.MemberCode;
                if (newMember != 0)
                {
                    System.Windows.Forms.BindingSource membros;
                    Igrejafont10DataSetTableAdapters.Membros1TableAdapter membrosTableAdapter1;
                    membros = new System.Windows.Forms.BindingSource(this.components);
                    ((System.ComponentModel.ISupportInitialize)(membros)).BeginInit();
                    membros.DataMember = "Membros1";
                    membros.DataSource = this.igrejafont10DataSet;
                    ((System.ComponentModel.ISupportInitialize)(membros)).EndInit();
                    membrosTableAdapter1 = new GerenciamentoCelulas.Igrejafont10DataSetTableAdapters.Membros1TableAdapter();
                    membrosTableAdapter1.ClearBeforeFill = true;

                    membrosTableAdapter1.Fill(igrejafont10DataSet.Membros1);

                    membros.Position = membros.Find("Codigo", newMember.ToString());
                    DataRowView row = (DataRowView)membros.Current;

                    row["Celula"] = celulaComboBox.SelectedValue.ToString();

                    membros.EndEdit();
                    membrosTableAdapter1.Update(igrejafont10DataSet.Membros1);

                    membrosTableAdapter.FillBy(igrejafont10DataSet.Membros);

                    FiltraMembros();
                }
            }
            else
            {
                MessageBox.Show("Por favor, selecione uma célula!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #8
0
 private void Savebutton_Click(object sender, EventArgs e)
 {
     try
     {
         bindingSource1.EndEdit();
         var progress = new Progress <PassedArgs>(percent =>
         {
             update();
         });
         rdb.UpdateEntities(EntityName, t.GetChanges(), progress);
         Logger.WriteLog($"Data Saved");
         MessageBox.Show("Data Saved");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         ErrorObject.Flag = Errors.Failed;
         ErrorObject.Ex   = ex;
         Logger.WriteLog($"Error in saving Data ({ex.Message}) ");
     }
 }
예제 #9
0
        public bool GenericEditAction(IEditable _geditForm, BindingSource actualActions, BindingSource groupHeadersList, bool isNew = false)
        {
            ulog = UserLog.Instance;
            try
            {
                DataRowView actionDataRowView;
                actionDataRowView = (isNew == false) ? (DataRowView)actualActions.Current : (DataRowView)actualActions.AddNew();
                if (actionDataRowView == null)
                    throw new Exception("Нет записей для редактирования.");

                using (IEditable editActForm = _geditForm)
                {//открываем форму и сохраняем изменения
                    if (editActForm.ShowDialog() == DialogResult.OK)
                    {
                        actualActions.EndEdit();
                        return true;
                    }
                    else
                    {
                        actualActions.CancelEdit();
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {
                actualActions.CancelEdit();
                ulog.Message(ex.Message, UserLogMessageLevel.Error);
                return false;
            }
            finally
            {
                groupHeadersList.RemoveFilter();
                groupHeadersList.Filter = "[InList] = 1";
            }
        }
예제 #10
0
파일: Utility.cs 프로젝트: Loong-Lee/VSDT
 /// <summary>
 /// 查询是否有更改
 /// </summary>
 /// <param name="isQuery">
 /// 是否是查询,true .是查询时,检查是否有更改,
 ///            false 当不是查询时,但输入有错误,则提示错误</param>
 /// <param name="tBindSource"></param>
 public static void CheckUnSavedChange(bool isQuery, System.Windows.Forms.BindingSource tBindSource)
 {
     try
     {
         tBindSource.EndEdit();
         DataSet dsBindSet = new DataSet();
         if (tBindSource.DataSource is DataSet)
         {
             dsBindSet = (DataSet)tBindSource.DataSource;
         }
         else if (tBindSource.DataSource is DataTable)
         {
             DataTable dt = (DataTable)tBindSource.DataSource;
             dsBindSet = dt.DataSet;
         }
         if (dsBindSet.HasChanges())
         {
             throw new Exception("数据已被更改。");
         }
     }
     catch (Exception ex)
     {
         if (!isQuery)
         {
             if (!ex.Message.Equals("数据已被更改。"))
             {
                 throw new Exception(ex.Message);
             }
         }
         DialogResult dr = EF.EFMessageBox.Show("继续将丢失未保存的更改,是否继续?", "epEname", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (dr == DialogResult.No)
         {
             throw new Exception("点击存盘.保存所做的更改。");
         }
     }
 }
예제 #11
0
        private void DepartmentStockInExtra_Load(object sender, EventArgs e)
        {
            rdoFastStockIn.Checked = true;

            DepartmentStockInEventArgs eventArgs = new DepartmentStockInEventArgs();
            EventUtility.fireEvent(LoadAllDepartments,this,eventArgs);
            if(eventArgs.DepartmentsList!= null && eventArgs.DepartmentsList.Count > 0)
            {
                BindingSource bdsDepartment = new BindingSource();
                bdsDepartment.DataSource = typeof (Department);
                cboDepartment.DataSource = bdsDepartment;
                cboDepartment.DisplayMember = "DepartmentName";
                foreach (Department department in eventArgs.DepartmentsList)
                {
                    if (department.DepartmentId != CurrentDepartment.Get().DepartmentId)
                    {
                        string deptId = department.DepartmentId.ToString();
                        string currId = CurrentDepartment.Get().DepartmentId.ToString();
                        if(currId.StartsWith(deptId))
                        {
                            bdsDepartment.Add(department);
                        }
                    }
                    if (ClientSetting.MarketDept.Equals(department.DepartmentId.ToString()))
                    {
                        bdsDepartment.Add(department);
                    }
                }
                bdsDepartment.EndEdit();
                cboDepartment.Refresh();
                cboDepartment.Invalidate();
            }

            foreach (Department department in cboDepartment.Items)
            {
                string departmentId = department.DepartmentId.ToString();
                string currentSubStock = CurrentDepartment.Get().DepartmentId.ToString();
                if (currentSubStock.StartsWith(departmentId))
                {
                    cboDepartment.SelectedItem = department;
                    cboDepartment.Enabled = false;
                    break;
                }
            }

            deptSODetailList = new DepartmentStockInDetailCollection(bdsStockIn);
            bdsStockIn.DataSource = deptSODetailList;
            dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError);
            UpdateStockOutDescription();
            GlobalMessage message = (GlobalMessage)GlobalUtility.GetObject("GlobalMessage");
            message.HasNewMessageEvent += new EventHandler<GlobalMessageEventArgs>(Instance_HasNewMessageEvent);
        }
        private void SaveDate()
        {
            this.gv_CustomerMaster.CloseEditor();
            BindingSource binding = new BindingSource();
            binding.DataSource = ((DataTable)gc_Customer.DataSource);
            gc_Customer.DataSource = binding;
            binding.EndEdit();

            if (DTCustomer.GetChanges() != null)
            {
                try
                {
                    ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DTCustomer.GetChanges(), "Bas_Customer");
                }
                catch (Exception)
                {

                    throw;
                }

            }
            LoadData();
        }
        private void SaveDate()
        {
            BindingSource binding = new BindingSource();
            binding.DataSource = ((DataTable)dgv_Common.DataSource);
            dgv_Common.DataSource = binding;
            binding.EndEdit();

            if (DT.GetChanges() != null)
            {

                ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DT.GetChanges(), "Bas_BoardQualityPrice");
            }
            LoadData();
        }
        private void SaveDate()
        {
            BindingSource binding=new BindingSource();
            binding.DataSource = ((DataTable)gc_Common.DataSource);
            gc_Common.DataSource = binding;
            binding.EndEdit();

            if (DT.GetChanges() != null)
            {
                try
                {
                    ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DT.GetChanges(), "Bas_PartType");
                }
                catch (Exception)
                {

                    throw;
                }

            }
            LoadData();
        }
        private void SaveDate()
        {
            gv_UpLoad.CloseEditor();
            BindingSource binding = new BindingSource();
            binding.DataSource = ((DataTable)gc_UpLoad.DataSource);
            gc_UpLoad.DataSource = binding;
            binding.EndEdit();

            if (DT.GetChanges() != null)
            {
                try
                {
                    ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DT.GetChanges(), "SYS_DOC");
                }
                catch (Exception)
                {

                    throw;
                }

            }
            LoadData();
        }
        private void DepartmentStockInExtra_Load(object sender, EventArgs e)
        {
            timer1.Start();
            cbbStockOutType.Enabled = false;
            btnReset.Enabled = false;
            cboProductMasters.Enabled = false;

            rdoFastStockOut.Checked = true;
            rdoRetail.Checked = true;
            IList list = new ArrayList();
            if (ClientSetting.IsSubStock())
            {
                list.Add(new StockDefectStatus {DefectStatusId = 7, DefectStatusName = "Xuất đi cửa hàng khác"});
            }
            else
            {
                list.Add(new StockDefectStatus { DefectStatusId = 4, DefectStatusName = "Xuất tạm để sửa hàng" });
                list.Add(new StockDefectStatus { DefectStatusId = 6, DefectStatusName = "Xuất trả về kho chính" });

            }
            DepartmentStockOutEventArgs eventArgs = new DepartmentStockOutEventArgs();
            EventUtility.fireEvent(LoadAllDepartments,this,eventArgs);
            string directDept = "";
            string marketDept = "";
            if(eventArgs.DepartmentsList!= null && eventArgs.DepartmentsList.Count > 0)
            {
                BindingSource bdsDepartment = new BindingSource();
                bdsDepartment.DataSource = typeof (Department);
                cboDepartment.DataSource = bdsDepartment;
                cboDepartment.DisplayMember = "DepartmentName";
                foreach (Department department in eventArgs.DepartmentsList)
                {
                    if (department.DepartmentId != CurrentDepartment.Get().DepartmentId)
                    {
                        /*if (!ClientSetting.IsSubStock())
                        {*/
                            bdsDepartment.Add(department);
                        /*}
                        else
                        {
                            string departmentId = department.DepartmentId.ToString();
                            string currentSubStock = CurrentDepartment.Get().DepartmentId.ToString();
                            if(currentSubStock.StartsWith(departmentId))
                            {
                                bdsDepartment.Add(department);
                                directDept = department.DepartmentName;
                            }
                            if(ClientSetting.MarketDept.Equals(departmentId))
                            {
                                bdsDepartment.Add(department);
                                marketDept = department.DepartmentName;
                            }
                        }*/

                    }
                }
                bdsDepartment.EndEdit();
                cboDepartment.Refresh();
                cboDepartment.Invalidate();
            }

            cbbStockOutType.DataSource = list;
            cbbStockOutType.DisplayMember = "DefectStatusName";
            /*if(!string.IsNullOrEmpty(directDept))
            {
                rdoFastStockOut.Text = " Xuất đến " + directDept;
            }*/
            /*foreach (Department department in cboDepartment.Items)
            {
                string departmentId = department.DepartmentId.ToString();
                string currentSubStock = CurrentDepartment.Get().DepartmentId.ToString();
                if (currentSubStock.StartsWith(departmentId))
                {
                    cboDepartment.SelectedItem = department;
                    cboDepartment.Enabled = false;
                    break;
                }
            }*/

            rdoFastStockOut_CheckedChanged(null, null);
            rdoStockOut_CheckedChanged(null, null);
            deptSODetailList = new DepartmentStockOutDetailCollection(bdsStockIn);
            bdsStockIn.DataSource = deptSODetailList;
            dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError);

            // create DepartmentStockIn
            if (deptSO == null)
            {
                deptSO = new DepartmentStockOut();
                deptSO.CreateDate = DateTime.Now;
                deptSO.UpdateDate = DateTime.Now;
                deptSO.CreateId = ClientInfo.getInstance().LoggedUser.Name;
                deptSO.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                deptSO.ExclusiveKey = 0;
                CreateNewStockInDetail();
            //                btnBarcode.Visible = false;
            //                numericUpDownBarcode.Visible = false;
            //                btnPreview.Visible = false;
                // load products to extra combo box
                LoadProductMasterToComboBox();
                deptSODetailList.RemoveAt(0);
                bdsStockIn.EndEdit();

            }
            else
            {
            //                btnBarcode.Visible = true;
            //                numericUpDownBarcode.Visible = true;
            //                btnPreview.Visible = true;
                IList deptStockInDetails = deptSO.DepartmentStockOutDetails;
                foreach (DepartmentStockOutDetail detail in deptStockInDetails)
                {
                    if (detail.DelFlg == CommonConstants.DEL_FLG_NO)
                    {
                        deptSODetailList.Add(detail);
                        //detail.OldQuantity = detail.Quantity;
                    }
                }

                for (int i = 0; i < dgvDeptStockIn.Columns.Count; i++)
                {
                    dgvDeptStockIn.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
                    if (i != QUANTITY_POS
                            && i != PRICE_POS
                            && i != SELL_PRICE_POS)
                    {
                        dgvDeptStockIn.Columns[i].ReadOnly = true;
                    }
                }
            //                txtDexcription.Text = deptSO.Description;
            }
            deptSO.DepartmentStockOutDetails =
                    ObjectConverter.ConvertToNonGenericList<DepartmentStockOutDetail>(deptSODetailList);

            UpdateStockOutDescription();
            cboDepartment.Enabled = false;
            GlobalMessage message = (GlobalMessage)GlobalUtility.GetObject("GlobalMessage");
            message.HasNewMessageEvent += new EventHandler<GlobalMessageEventArgs>(Instance_HasNewMessageEvent);
        }
        private void SaveDateWStitch()
        {
            this.gv_WStitch.CloseEditor();
            BindingSource binding = new BindingSource();
            binding.DataSource = ((DataTable)gc_WStitch.DataSource);
            gc_WStitch.DataSource = binding;
            binding.EndEdit();

            if (DTWStitch.GetChanges() != null)
            {
                try
                {
                    ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DTWStitch.GetChanges(), "PP_WStitch");
                }
                catch (Exception)
                {

                    throw;
                }

            }
        }
예제 #18
0
파일: Form1.cs 프로젝트: ruineto/portfolio
        private void fillTableAlunos(String turma)
        {
            using (SqlConnection myConnection = new SqlConnection(strConn))
            {
                myConnection.Open();
                String query2 = "select Nome, BI, Nif, DataNascimento as 'Data Nascimento', Email, Morada from GET_ALUNOS where Turma='" + turma + "';";
                SqlDataAdapter dAdapter = new SqlDataAdapter(query2, myConnection);
                SqlCommandBuilder cBuilder = new SqlCommandBuilder(dAdapter);

                DataTable dTable = new DataTable();
                dAdapter.Fill(dTable);

                BindingSource bSource = new BindingSource();
                bSource.DataSource = dTable;

                dataGridViewAlunos.DataSource = bSource;
                dataGridViewAlunos.EndEdit();
                bSource.EndEdit();
                myConnection.Close();
            }
        }
        private void SaveDate()
        {
            if (gv_Common.Editable)
            {
                gv_Common.CloseEditor();
            }
            BindingSource binding = new BindingSource();
            binding.DataSource = ((DataTable)gc_Common.DataSource);
            gc_Common.DataSource = binding;
            binding.EndEdit();

            try
            {
                if (DT.GetChanges() != null)
                {

                    ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DT.GetChanges(), "Bas_FormulaByWorking");
                }

            }
            catch (Exception)
            {

                throw;
            }

            LoadData();
        }
예제 #20
-1
        private void CreateNewBlankPurchaseOrderDetail(BindingSource bill)
        {
            PurchaseOrderDetail orderDetail = (PurchaseOrderDetail)bill.AddNew();
            orderDetail.CreateId = ClientInfo.getInstance().LoggedUser.Name;
            orderDetail.CreateDate = DateTime.Now;
            orderDetail.UpdateDate = DateTime.Now;
            orderDetail.UpdateId = orderDetail.CreateId;
            orderDetail.DelFlg = 0;
            orderDetail.DepartmentId = CurrentDepartment.Get().DepartmentId;
            orderDetail.Quantity = 1;

            PurchaseOrderDetailPK purchaseOrderDetailPK = new PurchaseOrderDetailPK();
            purchaseOrderDetailPK.DepartmentId = CurrentDepartment.Get().DepartmentId;
            orderDetail.PurchaseOrderDetailPK = purchaseOrderDetailPK;

            // new product to test
            ProductMaster productMaster = new ProductMaster();
            orderDetail.ProductMaster = productMaster;
            Product product = new Product();
            product.ProductMaster = orderDetail.ProductMaster;
            orderDetail.Product = product;
            bill.EndEdit();
        }