コード例 #1
0
        private void Update(DataSources.dsTeachersUnion.TBLMembersRow row, bool DetailsTabFocus)
        {
            TBLMembersFastKidWFrm frm;
            if (DetailsTabFocus)
                frm = new TBLMembersFastKidWFrm(row, _Insert, _Update, _Delete, true);
            else
                frm = new TBLMembersFastKidWFrm(row, _Insert, _Update, _Delete, false);
            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                return;

            try
            {
                row.userin = Program.UserInfo.UserId;
                row.datein = SQLProvider.GetServerDateTime();

                if (row.RowState == DataRowState.Detached)
                {
                    row.RandomCard = new Random().Next(100, 999).ToString();
                    row.MemberShipNumber = (int)tblMembersTableAdapter.ScalarQueryNewMemberShipNumber();

                    dsTeachersUnion.TBLMembers.AddTBLMembersRow(row);
                    row.EndEdit();
                    tblMembersTableAdapter.Update(row);
                    row.MemberId = (int)tblMembersTableAdapter.ScalarQueryKideNumberByMemberId(row.KideNumber);
                    dsTeachersUnion.TBLMembers.AcceptChanges();
                    row.SetModified();
                    Update(row, true);
                }
                else
                {
                    tblMembersTableAdapter.Update(row);
                    dsTeachersUnion.TBLMembers.AcceptChanges();
                    Program.Logger.LogThis("تم الحفظ", Text, FXFW.Logger.OpType.success, null, null, this);
                }
             
            }
            catch (Exception ex)
            {
                Program.ShowMsg(Misc.Misc.ExceptionMessage(ex), true, this);
                Program.Logger.LogThis(null, Text, FXFW.Logger.OpType.fail, ex, null, this);
            }
            
        }