示例#1
0
 public bool InsertData()
 {
     return(BaseDataBase._StoredProcedure("sp_Add2MergedFamilyTable"
                                          , new SqlParameter("@FamilyID", FamilyID)
                                          , new SqlParameter("@StudySideID", StudySideID)
                                          , new SqlParameter("@FamilyName", FamilyName)
                                          , new SqlParameter("@FamilyType", FamilyType)
                                          , new SqlParameter("@FamilyIdentityID", FamilyIdentityID)
                                          , new SqlParameter("@FatherFirstName", FatherFirstName)
                                          , new SqlParameter("@FatherLastName", FatherLastName)
                                          , new SqlParameter("@MotherFirstName", MotherFirstName)
                                          , new SqlParameter("@MotherLastName", MotherLastName)
                                          , new SqlParameter("@ChildCount", ChildCount)
                                          , new SqlParameter("@FatherPID", FatherPID)
                                          , new SqlParameter("@MotherPID", MotherPID)
                                          , new SqlParameter("@ApplyDate", ApplyDate)
                                          , new SqlParameter("@ListDate", ListDate)
                                          , new SqlParameter("@Evaluation", Evaluation)
                                          , new SqlParameter("@EvaluationReason", EvaluationReason)
                                          , new SqlParameter("@DateOfEvaluation", DateOfEvaluation)
                                          , new SqlParameter("@IsCanceled", IsCanceled)
                                          , new SqlParameter("@CancelDate", CancelDate)
                                          , new SqlParameter("@CancelReason", CancelReason)
                                          , new SqlParameter("@Notes", Notes)));
 }
示例#2
0
        public static async Task <bool> DeleteData(Inventory x)
        {
            await Inventory.UpdateData(x);

            return(await BaseDataBase._StoredProcedureAsync("sp_Delete_Inventory"
                                                            , new SqlParameter("@ID", x.ID)));
        }
示例#3
0
 public static bool UpdateData(User x)
 {
     x.Password = User.ComputeHash(x.Password, "SHA512", null);
     return(BaseDataBase._StoredProcedure("sp_UpdateUsers"
                                          , new SqlParameter("@ID", x.ID)
                                          , new SqlParameter("@Name", x.Name)
                                          , new SqlParameter("@Password", x.Password)
                                          , new SqlParameter("@IsAdmin", x.IsAdmin)
                                          , new SqlParameter("@CanAdd", x.CanAdd)
                                          , new SqlParameter("@CanUpdate", x.CanUpdate)
                                          , new SqlParameter("@CanDelete", x.CanDelete)
                                          , new SqlParameter("@CanPresent", x.CanPresent)
                                          , new SqlParameter("@CanEnterTempFamily", x.CanEnterTempFamily)
                                          , new SqlParameter("@CanEnterFamily", x.CanEnterFamily)
                                          , new SqlParameter("@CanUpdateFamily", x.CanUpdateFamily)
                                          , new SqlParameter("@CanEnterFamilyNeed", x.CanEnterFamilyNeed)
                                          , new SqlParameter("@CanEnterListerGroup", x.CanEnterListerGroup)
                                          , new SqlParameter("@CanMakeStatistics", x.CanMakeStatistics)
                                          , new SqlParameter("@CanCancelTempFamily", x.CanCancelTempFamily)
                                          , new SqlParameter("@CanDeleteTempFamily", x.CanDeleteTempFamily)
                                          , new SqlParameter("@CanCancelFamily", x.CanCancelFamily)
                                          , new SqlParameter("@CanExport", x.CanExport)
                                          , new SqlParameter("@CanPrintReports", x.CanPrintReports)
                                          , new SqlParameter("@CanUpdateSupport", x.CanUpdateSupport)
                                          , new SqlParameter("@CanDeleteSupport", x.CanDeleteSupport)
                                          , new SqlParameter("@IT", x.IT)
                                          , new SqlParameter("@PointAdmin", x.PointAdmin)
                                          , new SqlParameter("@ReportCreator", x.ReportCreator)));
 }
示例#4
0
        public static bool UpdateData(Order x)
        {
            //foreach (var item in x.FamilyNeeds)
            //{
            //    if (item.IsEnsured)
            //        item.OrderID = x.Id;
            //    else item.OrderID = null;
            //    FamilyNeed_ListerGroup.UpdateData(item);
            //}

            x.LastUserID = BaseDataBase.CurrentUser.ID.Value;
            return(BaseDataBase._StoredProcedure("sp_Update_Order"
                                                 , new SqlParameter("@Id", x.Id)
                                                 , new SqlParameter("@InventoryID", x.InventoryID)
                                                 , new SqlParameter("@FamilyID", x.FamilyID)
                                                 , new SqlParameter("@SpecialFamilyID", x.SpecialFamilyID)
                                                 , new SqlParameter("@OrphanID", x.OrphanID)
                                                 , new SqlParameter("@Type", x.Type)
                                                 , new SqlParameter("@Date", x.Date)
                                                 , new SqlParameter("@NextOrderDate", x.NextOrderDate)
                                                 , new SqlParameter("@Description", x.Description)
                                                 , new SqlParameter("@Source", x.Source)
                                                 , new SqlParameter("@InvoiceSerial", x.InvoiceSerial)
                                                 , new SqlParameter("@Notes", x.Notes)
                                                 , new SqlParameter("@LastUserID", x.LastUserID)));
        }
 private void btnDelLister_Click(object sender, RoutedEventArgs e)
 {
     if (dgSupervisor.SelectedIndex != -1)
     {
         if (!BaseDataBase.CurrentUser.CanDelete)
         {
             MyMessageBox.Show("ليس لديك صلاحيات للحذف");
         }
         else
         {
             Supervisor s = Supervisor.GetSupervisorByID((int)(dgSupervisor.Items[dgSupervisor.SelectedIndex] as DataRowView)[0]);
             if (int.Parse(BaseDataBase._Scalar("select dbo.fn_SupervisorOrphansCount(" + s.SupervisorID + ")")) > 0)
             {
                 MyMessageBox.Show("لا يمكن حذف المشرف \nبسبب وجود بيانات إشراف سابقة له");
             }
             else if (int.Parse(BaseDataBase._Scalar("select COUNT(ID) from Trained where TrainedType = 3 and TrainedID = " + s.SupervisorID)) > 0)
             {
                 MyMessageBox.Show("لا يمكن حذف المشرف \nبسبب وجود بيانات تدريب سابقة له");
             }
             else
             {
                 if (s.DeleteSupervisorData())
                 {
                     dgSupervisor.ItemsSource = Supervisor.GetAllSupervisorTable;
                     MyMessage.DeleteMessage();
                 }
             }
         }
     }
 }
        public NextOrderCriteriaControl()
        {
            InitializeComponent();

            try { nudDaysSpecialFamily.Value = int.Parse(SystemProperties.GetSystemPropertyValue(SystemProperties.Property.NextOrderSpecialFamily)); }
            catch { }
            try { nudNextOrderGap.Value = int.Parse(SystemProperties.GetSystemPropertyValue(SystemProperties.Property.NextOrderGap)); }
            catch { }

            var dt = BaseDataBase._Tabling("select FromMember,ToMember,NumberOfDays from NextOrderCriteria");

            if (dt != null && dt.Rows.Count > 0)
            {
                var lst = new List <NextOrderCriteria>();
                foreach (DataRow item in dt.Rows)
                {
                    lst.Add(new NextOrderCriteria()
                    {
                        FromMember = (int)item[0], ToMember = (int)item[1], NumberOfDays = (int)item[2]
                    });
                }
                dg.ItemsSource = lst;
            }
            else
            {
                dg.ItemsSource = new List <NextOrderCriteria>();
            }

            dgSector.ItemsSource = Sector.GetAllSector();
        }
示例#7
0
        public StaOrphan()
        {
            InitializeComponent();

            cmboImpeding.ItemsSource = BaseDataBase.GetAllStringsWithAll("select distinct impedingType from impeding");
            cmboHealth.ItemsSource   = BaseDataBase.GetAllStringsWithAll("select Distinct HealthSituation from OrphanHealth");
        }
示例#8
0
        public Transition_OrphanFamilyWindow(Family f)
        {
            InitializeComponent();
            this.f         = f;
            txtFamily.Text = f.FamilyCode;
            var i = new Invoice();

            foreach (var o in f.FamilyOrphans.Where(x => x.Type != "طالب علم" && x.CurrentSponsorship != null))
            {
                var t = i.AddTransition();
                t.RightAccount = o.Account;
                t.Value        = o.CurrentSponsorship.AvailableSponsorship.SponsorshipValue;
                t.Value        = o.CurrentSponsorship.IsDouble ? t.Value * 2 : t.Value;
                t.Details      = "دفعة من صندوق الايتام";
                t.LeftAccount  = new Account()
                {
                    Id = (o.Type == "يتيم" ? 2 : 3)
                };                                                                //the id of ophan fund (2) account or ophan student fund (3) account
                t.RelatedSponsorship            = o.CurrentSponsorship;
                t.RelatedSponsorship.OrphanName = o.FirstName + " " + o.LastName;
                t.SponsorshipID = o.CurrentSponsorship.ID;
                t.AccountType   = (o.Type == "يتيم" ? Account.AccountType.Orphan : Account.AccountType.OrphanStudent); //the ophan type (2) or ophan student type (3)
            }

            i.Serial         = "A";
            i.Receiver       = BaseDataBase._Scalar($"select FirstName + ' ' + Isnull(LastName,'') from Parent where FamilyID = {f.FamilyID} and Gender = 'أنثى'");
            i.ReceiverPID    = BaseDataBase._Scalar($"select IsNull(PID,'') from Parent where FamilyID = {f.FamilyID} and Gender = 'أنثى'");
            this.DataContext = i;
        }
示例#9
0
 private void cmboReciever_Changed(object sender, SelectionChangedEventArgs e)
 {
     if (IsLoaded)
     {
         var i = this.DataContext as Invoice;
         if ((sender as ComboBox).SelectedIndex == 3)
         {
             txtReceiver.IsReadOnly    = false;
             txtReceiverPID.IsReadOnly = false;
             i.Receiver    = "";
             i.ReceiverPID = "";
         }
         else
         {
             txtReceiver.IsReadOnly    = true;
             txtReceiverPID.IsReadOnly = true;
             if ((sender as ComboBox).SelectedIndex == 0)
             {
                 i.Receiver    = BaseDataBase._Scalar($"select FirstName + ' ' + Isnull(LastName,'') from Parent where FamilyID = {f.FamilyID} and Gender = 'أنثى'");
                 i.ReceiverPID = BaseDataBase._Scalar($"select IsNull(PID,'') from Parent where FamilyID = {f.FamilyID} and Gender = 'أنثى'");
             }
             else if ((sender as ComboBox).SelectedIndex == 1)
             {
                 i.Receiver    = BaseDataBase._Scalar($"select FirstName + ' ' + Isnull(LastName,'') from Guardian where FamilyID = {f.FamilyID} and Gender = 'أنثى'");
                 i.ReceiverPID = BaseDataBase._Scalar($"select IsNull(PID,'') from Guardian where FamilyID = {f.FamilyID} and Gender = 'أنثى'");
             }
             else
             {
                 i.Receiver    = BaseDataBase._Scalar($"select FirstName + ' ' + Isnull(LastName,'') from Guardian where FamilyID = {f.FamilyID} and Gender = N'ذكر'");
                 i.ReceiverPID = BaseDataBase._Scalar($"select IsNull(PID,'') from Guardian where FamilyID = {f.FamilyID} and Gender = N'ذكر'");
             }
         }
     }
 }
示例#10
0
        private void ChekStudySide()
        {
            int    i;
            string s = BaseDataBase._Scalar("Select Count(IsLocal) from MergedStudySide where IsLocal = 1");

            if (string.IsNullOrEmpty(s))
            {
                MyMessageBox.Show("حدثت مشكلة في قاعدة البيانات يرجى مراجعة فريق الدعم");
                Environment.Exit(Environment.ExitCode);
            }
            else
            {
                i = int.Parse(s);
                if (i == 0)
                {
                    StudySideInsertControl w = new StudySideInsertControl();
                    if (!w.ShowDialog() == true)
                    {
                        Environment.Exit(Environment.ExitCode);
                    }
                }
                else if (i > 1)
                {
                    MyMessageBox.Show("حدثت مشكلة في قاعدة البيانات يرجى مراجعة فريق الدعم");
                    Environment.Exit(Environment.ExitCode);
                }
            }
        }
        public Transition_Expenses(FundType ft)
        {
            InitializeComponent();
            var i = new Invoice();
            var t = i.AddTransition();

            t.LeftAccount = new Account {
                Id = 1
            };                                          //1 is general fund account id
            t.RightAccount = new Account {
                Id = 5
            };                                          //5 is expenses account id

            if (ft == FundType.GeneralHidden)
            {
                t.IsHidden         = true;
                txtMsg1.Visibility = Visibility.Visible;
                txtMsg2.Visibility = Visibility.Collapsed;
                var r = BaseDataBase._Scalar($@"select dbo.fn_GetHiddenBalance()");
                txtBalance.Text = r;
            }
            else
            {
                var r = BaseDataBase._Scalar($@"(select
			        (select isnull(sum(Value),0) from Transition where IsHidden = 0 and RightAccount = 1 - 
			        (select isnull(sum(Value),0) from Transition where IsHidden = 0 and LeftAccount = 1))"            );
                txtBalance.Text = r;
            }
            this.DataContext = i;
        }
示例#12
0
        public VoucherCriteriaControl()
        {
            InitializeComponent();

            VoucherGruopItems = new Dictionary <int, List <Item> >();
            var         dt      = BaseDataBase._Tabling("Select GroupID, ItemID from VoucherCriteria order by GroupID");
            int         GroupID = 0;
            List <Item> items   = null;

            foreach (DataRow item in dt.Rows)
            {
                int x = (int)item[0];
                if (x != GroupID)
                {
                    if (GroupID != 0)
                    {
                        VoucherGruopItems.Add(GroupID, items);
                    }
                    GroupID = x;
                    items   = new List <Item>();
                }
                items.Add(Item.GetItemByID((int)item[1]));
            }
            if (GroupID != 0)
            {
                VoucherGruopItems.Add(GroupID, items);
            }
            lstMain.ItemsSource = VoucherGruopItems;
        }
示例#13
0
 public static bool UpdateData(Property p, string value)
 {
     return(BaseDataBase._StoredProcedure("sp_Update_SystemProperties",
                                          new SqlParameter("@PropertyName", p.ToString()),
                                          new SqlParameter("@PropertyValue", value),
                                          new SqlParameter("@LastUserID", BaseDataBase.CurrentUser.ID)));
 }
示例#14
0
        public async void GetData()
        {
            await DBMain.UpdateAllPregnant();

            List <string> lst1, lst2, lst3, lst4, lst5, lst6, lst7, lst8;

            lst1 = lst2 = lst3 = lst4 = lst5 = lst6 = lst7 = lst8 = null;
            await Task.Run(() =>
            {
                lst1 = BaseDataBase.GetAllStringsWithAll("select distinct job from (select Job from Parent Union select Job from FamilyPerson) x where ISNULL(Job,'') <> '' order by Job");
                lst2 = BaseDataBase.GetAllStringsWithAll("select distinct HealthStatus from (select HealthStatus from Parent Union select HealthStatus from FamilyPerson) x WHERE ISNULL(HealthStatus,'') <> '' order by HealthStatus");
                lst3 = BaseDataBase.GetAllStringsWithAll("select distinct StudyStatus from (select StudyStatus from Parent Union select StudyStatus from FamilyPerson) x where Isnull(StudyStatus,'') <> '' order by StudyStatus");
                lst4 = BaseDataBase.GetAllStringsWithAll("select distinct HouseSection from House where ISNULL(HouseSection,'') <> '' order by HouseSection");
                lst5 = BaseDataBase.GetAllStringsWithAll("select distinct HouseStreet from House where isnull(HouseStreet,'') <> '' order by HouseStreet");
                lst6 = BaseDataBase.GetAllStringsWithAll("select distinct OldAddress from House x where ISNULL(OldAddress,'') <> '' order by OldAddress");
                lst7 = BaseDataBase.GetAllStringsWithAll("select distinct impededType from (select impededType from Parent Union select impededType from FamilyPerson) x where ISNULL(impededType,'') <> '' order by impededType");
                lst8 = BaseDataBase.GetAllStringsWithAll("select distinct RelationShip from (select 'أب' RelationShip Union select 'أم' Union (select RelationShip from FamilyPerson)) x where ISNULL(RelationShip,'') <> '' order by RelationShip");
            });

            cmboJob.ItemsSource          = lst1;
            cmboHealthStatus.ItemsSource = lst2;
            cmboStudyStatus.ItemsSource  = lst3;
            cmboHouseSection.ItemsSource = lst4;
            cmboHouseStreet.ItemsSource  = lst5;
            cmboOldAddress.ItemsSource   = lst6;
            cmboImpedeType.ItemsSource   = lst7;
            cmboRelationShip.ItemsSource = lst8;
        }
示例#15
0
 private void Rad1_Checked(object sender, RoutedEventArgs e)
 {
     if (radBasePlace.IsChecked == true)
     {
         column = "OldAddress";
     }
     else if (radAddress.IsChecked == true)
     {
         column = "HouseSection";
     }
     else if (radStreet.IsChecked == true)
     {
         column = "HouseStreet";
     }
     else if (radPoint.IsChecked == true)
     {
         column = "Address";
     }
     else if (radJob.IsChecked == true)
     {
         column = "Job";
     }
     else if (radHealth.IsChecked == true)
     {
         column = "HealthStatus";
     }
     else
     {
         column = "";
     }
     lstData.ItemsSource = column == "" ? null : BaseDataBase.GetAllStrings("Select Distinct " + column + " from " + (column == "Job" || column == "HealthStatus" ? "Parent" : "House") + " order by " + column);
 }
示例#16
0
        public Transition_SponsorWindow(Sponsor s, FundType ft)
        {
            InitializeComponent();
            txtSponsorName.Text = s.Name;
            var i = new Invoice();

            i.AddTransition();
            i.Transitions[0].LeftAccount = s.Account;

            if (ft == FundType.GeneralHidden)
            {
                i.Transitions[0].IsHidden = true;
                txtHeader.Text           += " (ايداع مخفي)";
            }

            if (ft == FundType.Private)
            {
                cmboAccounts.ItemsSource = BaseDataBase._Tabling("select Id, Name from Account where Id between 2 and 4").DefaultView;
            }
            else
            {
                cmboAccounts.ItemsSource   = BaseDataBase._Tabling("select Id, Name from Account where Id = 1").DefaultView;
                cmboAccounts.SelectedIndex = 0;
                GetCurrentBalance(s.Account.Id.Value, 1);
            }

            this.DataContext = i;
        }
示例#17
0
        private void save_Click(object sender, RoutedEventArgs e)
        {
            if (lstData.SelectedItems.Count <= 0)
            {
                MyMessageBox.Show("لم يتم اختيار أي قيمة للتعديل");
                return;
            }
            if (txtUpdatedValue.Text.Trim() == "")
            {
                MyMessageBox.Show("يجب ادخال القيمة الجديدة");
                return;
            }
            if (MyMessageBox.Show("هل تريد تأكيد تعديل البيانات", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                string query = "Update " + (column == "Job" || column == "HealthStatus" ? "Parent" : "House") + " set " + column + " = '" + txtUpdatedValue.Text.Replace("\'", "").Trim() + "' where " + column + " in (";
                foreach (string item in lstData.SelectedItems)
                {
                    query += "'" + item.Replace("\'", "") + "',";
                }
                query = query.Remove(query.Length - 1) + ")";

                MyMessageBox.Show("تم تعديل " + BaseDataBase._NonQuery(query) + " قيمة في قاعدة البيانات");


                lstData.ItemsSource = column == "" ? null : BaseDataBase.GetAllStrings("Select Distinct " + column + " from " + (column == "Job" || column == "HealthStatus" ? "Parent" : "House") + " order by " + column);
            }
        }
示例#18
0
 public FamilyOrderControl(Order order)
 {
     InitializeComponent();
     if (order.FamilyID.HasValue)
     {
         int.TryParse(BaseDataBase._Scalar($"select Max(Id) from [order] where FamilyID = " + order.FamilyID), out CurrentMaxOrderID);
     }
     else
     {
         int.TryParse(BaseDataBase._Scalar($"select Max(Id) from [order] where SpecialFamilyID = " + order.SpecialFamilyID), out CurrentMaxOrderID);
     }
     this.DataContext          = order;
     dgOrderItems.ItemsSource  = order.OIs;
     cmboInventory.ItemsSource = Inventory.GetAllInventory().Where(x => x.IsActive);
     if (!order.Id.HasValue)
     {
         order.Date = BaseDataBase.DateNow;
         if (order.Type == 3)
         {
             // if the order is urgent no need to select NextOrderDate
             if (!order.IsUrgentOrder)
             {
                 order.NextOrderDate = order.Date.Value.AddDays(int.Parse(BaseDataBase._Scalar($"select dbo.GetNextOrderDaysByFamilyID({order.FamilyID})")));
                 //if the NextOrderDate is Friday or Thursday .. change it to Satruday
                 order.NextOrderDate = order.NextOrderDate.Value.DayOfWeek == DayOfWeek.Thursday || order.NextOrderDate.Value.DayOfWeek == DayOfWeek.Friday ? order.NextOrderDate.Value.AddDays(2) : order.NextOrderDate.Value;
             }
             btnSelectItems_Click(null, null);
         }
     }
     //if(!order.Id.HasValue)
     //        i.FamilyNeeds = FamilyNeed_ListerGroup.GetFamilyNeed_ListerGroupBySupportGroupID(-1, i.FamilyID.Value);
     //  else  i.FamilyNeeds = FamilyNeed_ListerGroup.GetFamilyNeed_ListerGroupBySupportGroupID(i.SupportGroupID, i.FamilyID.Value);
 }
示例#19
0
 public static bool DeleteData(Order_Item x)
 {
     //Order_Item.UpdateData(x);
     return(BaseDataBase._StoredProcedure("sp_Delete_Order_Item"
                                          , new SqlParameter("@OrderID", x.Order.Id)
                                          , new SqlParameter("@ItemID", x.Item.Id)));
 }
示例#20
0
 private void btnDelLister_Click(object sender, RoutedEventArgs e)
 {
     if (dgListers.SelectedIndex != -1)
     {
         if (!BaseDataBase.CurrentUser.CanDelete)
         {
             MyMessageBox.Show("ليس لديك صلاحيات للحذف");
         }
         else
         {
             Lister l = Lister.GetListerByID((int)(dgListers.Items[dgListers.SelectedIndex] as DataRowView)[0]);
             if (int.Parse(BaseDataBase._Scalar("select dbo.GetGroupCountByListerID(" + l.ListerID + ")")) > 0)
             {
                 MyMessageBox.Show("لا يمكن حذف المقيّم \nبسبب وجود بيانات تقييم سابقة له ضمن فرق التقييم");
             }
             else if (int.Parse(BaseDataBase._Scalar("select COUNT(ID) from Trained where TrainedType = 2 and TrainedID = " + l.ListerID)) > 0)
             {
                 MyMessageBox.Show("لا يمكن حذف المقيّم \nبسبب وجود بيانات تدريب سابقة له");
             }
             else if (DBMain.DeleteData(l))
             {
                 dgListers.ItemsSource = Lister.GetAllListersTable;
                 MyMessage.DeleteMessage();
             }
         }
     }
 }
示例#21
0
        public async void GetData()
        {
            List <string> lst1 = null;
            await Task.Run(() => lst1 = BaseDataBase.GetAllStringsWithAll("select distinct NeedType from FamilyNeed"));

            cmboNeedType.ItemsSource = lst1;
        }
示例#22
0
 public static bool UpdateData(Item x)
 {
     return(BaseDataBase._StoredProcedure("sp_Update_Item"
                                          , new SqlParameter("@Id", x.Id)
                                          , new SqlParameter("@Name", x.Name)
                                          , new SqlParameter("@IsActive", x.IsActive)
                                          , new SqlParameter("@IsBasket", x.IsBasket)
                                          , new SqlParameter("@Source", x.Source)
                                          , new SqlParameter("@Barcode", x.Barcode)
                                          , new SqlParameter("@ItemType", x.ItemType)
                                          , new SqlParameter("@Description", x.Description)
                                          , new SqlParameter("@StandardUnit", x.StandardUnit)
                                          , new SqlParameter("@Unit2", x.Unit2)
                                          , new SqlParameter("@Unit2Convert", x.Unit2Convert)
                                          , new SqlParameter("@Unit3", x.Unit3)
                                          , new SqlParameter("@Unit3Convert", x.Unit3Convert)
                                          , new SqlParameter("@MinimumQuantity", x.MinimumQuantity)
                                          , new SqlParameter("@MaximumQuantity", x.MaximumQuantity)
                                          , new SqlParameter("@MaxQuantityPerOrder", x.MaxQuantityPerOrder)
                                          , new SqlParameter("@MaxQuantityPerFamily", x.MaxQuantityPerFamily)
                                          , new SqlParameter("@MaxQuantityPerDay", x.MaxQuantityPerDay)
                                          , new SqlParameter("@WarningQuantity", x.WarningQuantity)
                                          , new SqlParameter("@Weight", x.Weight)
                                          , new SqlParameter("@DefaultLocation", x.DefaultLocation)
                                          , new SqlParameter("@Notes", x.Notes)
                                          , new SqlParameter("@LastUserID", BaseDataBase.CurrentUser.ID)));
 }
示例#23
0
        private void txtDigitalNumber_TextChanged(object sender, TextChangedEventArgs e)
        {
            var f = this.DataContext as Family;

            if (f != null)
            {
                if (!string.IsNullOrEmpty(txtDigitalNumber.Text))
                {
                    var dt = BaseDataBase._Tabling($@"select FamilyCode from Family where FamilyID in
                    (select FamilyID from house where 
                    DigitalAddress like '{txtDigitalNumber.Text}'" +
                                                   (f.FamilyID.HasValue ? $" and familyID <> {f.FamilyID})" : ")"));
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        string s = "العنوان الرقمي المدخل موجود في:";
                        foreach (DataRow r in dt.Rows)
                        {
                            s += "\n" + r.ItemArray[0].ToString();
                        }
                        txtDigitalNumberFamilies.Text = s;
                        pop.IsOpen = true;
                    }
                    else
                    {
                        pop.IsOpen = false;
                    }
                }
            }
        }
示例#24
0
        public bool InsertSupervisorData()
        {
            IdentityImage = BaseDataBase.CheckImageFile(IdentityImage);

            SupervisorID = BaseDataBase._StoredProcedureReturnable("sp_Add2Supervisor"
                                                                   , new SqlParameter("@SupervisorID", System.Data.SqlDbType.Int)
                                                                   , new SqlParameter("@FirstName", FirstName)
                                                                   , new SqlParameter("@LastName", LastName)
                                                                   , new SqlParameter("@BirthPlace", BirthPlace)
                                                                   , new SqlParameter("@DOB", DOB)
                                                                   , new SqlParameter("@Gender", Gender)
                                                                   , new SqlParameter("@Job", Job)
                                                                   , new SqlParameter("@Slary", Slary)
                                                                   , new SqlParameter("@Phone", Phone)
                                                                   , new SqlParameter("@Mobile", Mobile)
                                                                   , new SqlParameter("@Email", Email)
                                                                   , new SqlParameter("@MaritalStatus", MaritalStatus)
                                                                   , new SqlParameter("@ChildCount", ChildCount)
                                                                   , new SqlParameter("@IdentityImage", IdentityImage)
                                                                   , new SqlParameter("@PlaceAddress", PlaceAddress)
                                                                   , new SqlParameter("@ScientificQualifier", ScientificQualifier)
                                                                   , new SqlParameter("@Major", Major)
                                                                   , new SqlParameter("@IsActivated", IsActivated)
                                                                   , new SqlParameter("@NotActivatedReason", NotActivatedReason)
                                                                   , new SqlParameter("@Notes", Notes));
            return(SupervisorID != null);
        }
示例#25
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            switch (cmboPrintType.SelectedIndex)
            {
            case 0:
                DGMain.ItemsSource = BaseDataBase._TablingStoredProcedure("GetTempFamilyAllTableForPrint").DefaultView;
                var uc1 = ucCurrent as ReportTempFamilyControlAll;
                if (uc1 != null)
                {
                    uc1.Changing();
                }
                DGMain_Loaded(DGMain, null);
                break;

            case 1:
                DGMain.ItemsSource = BaseDataBase._TablingStoredProcedure("GetFixedFamilyAllTableForPrint").DefaultView;
                var uc2 = ucCurrent as ReportFixedFamilyControlAll;
                if (uc2 != null)
                {
                    uc2.Changing();
                }
                DGMain_Loaded(DGMain, null);
                break;
            }
        }
示例#26
0
        public bool UpdateSupervisorData()
        {
            IdentityImage = BaseDataBase.CheckImageFile(IdentityImage, Supervisor.GetSupervisorByID(SupervisorID).IdentityImage);

            return(BaseDataBase._StoredProcedure("sp_UpdateSupervisor"
                                                 , new SqlParameter("@SupervisorID", SupervisorID)
                                                 , new SqlParameter("@FirstName", FirstName)
                                                 , new SqlParameter("@LastName", LastName)
                                                 , new SqlParameter("@BirthPlace", BirthPlace)
                                                 , new SqlParameter("@DOB", DOB)
                                                 , new SqlParameter("@Gender", Gender)
                                                 , new SqlParameter("@Job", Job)
                                                 , new SqlParameter("@Slary", Slary)
                                                 , new SqlParameter("@Phone", Phone)
                                                 , new SqlParameter("@Mobile", Mobile)
                                                 , new SqlParameter("@Email", Email)
                                                 , new SqlParameter("@MaritalStatus", MaritalStatus)
                                                 , new SqlParameter("@ChildCount", ChildCount)
                                                 , new SqlParameter("@IdentityImage", IdentityImage)
                                                 , new SqlParameter("@PlaceAddress", PlaceAddress)
                                                 , new SqlParameter("@ScientificQualifier", ScientificQualifier)
                                                 , new SqlParameter("@Major", Major)
                                                 , new SqlParameter("@IsActivated", IsActivated)
                                                 , new SqlParameter("@NotActivatedReason", NotActivatedReason)
                                                 , new SqlParameter("@Notes", Notes)));
        }
示例#27
0
        public static bool InsertData(User x)
        {
            x.ID = BaseDataBase._StoredProcedureReturnable("sp_Add2Users"
                                                           , new SqlParameter("@ID", System.Data.SqlDbType.Int)
                                                           , new SqlParameter("@Name", x.Name)
                                                           , new SqlParameter("@Password", User.ComputeHash(x.Password, "SHA512", null))
                                                           , new SqlParameter("@IsAdmin", x.IsAdmin)
                                                           , new SqlParameter("@CanAdd", x.CanAdd)
                                                           , new SqlParameter("@CanUpdate", x.CanUpdate)
                                                           , new SqlParameter("@CanDelete", x.CanDelete)
                                                           , new SqlParameter("@CanPresent", x.CanPresent)
                                                           , new SqlParameter("@CanEnterTempFamily", x.CanEnterTempFamily)
                                                           , new SqlParameter("@CanEnterFamily", x.CanEnterFamily)
                                                           , new SqlParameter("@CanUpdateFamily", x.CanUpdateFamily)
                                                           , new SqlParameter("@CanEnterFamilyNeed", x.CanEnterFamilyNeed)
                                                           , new SqlParameter("@CanEnterListerGroup", x.CanEnterListerGroup)
                                                           , new SqlParameter("@CanMakeStatistics", x.CanMakeStatistics)
                                                           , new SqlParameter("@CanCancelTempFamily", x.CanCancelTempFamily)
                                                           , new SqlParameter("@CanDeleteTempFamily", x.CanDeleteTempFamily)
                                                           , new SqlParameter("@CanCancelFamily", x.CanCancelFamily)
                                                           , new SqlParameter("@CanExport", x.CanExport)
                                                           , new SqlParameter("@CanPrintReports", x.CanPrintReports)
                                                           , new SqlParameter("@CanUpdateSupport", x.CanUpdateSupport)
                                                           , new SqlParameter("@CanDeleteSupport", x.CanDeleteSupport)
                                                           , new SqlParameter("@IT", x.IT)
                                                           , new SqlParameter("@PointAdmin", x.PointAdmin)
                                                           , new SqlParameter("@ReportCreator", x.ReportCreator)
                                                           );

            return(x.ID.HasValue);
        }
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                var dt = e.Argument as DataTable;
                dt2 = dt.Copy();
                var dv = dt2.DefaultView;

                string s = string.Format("(FamilyCode like '{0}*'", s1);
                s += BaseDataBase.IsStringNumber(s1) ? string.Format(" or FamilyID = {0})", s1) : ")";

                dv.RowFilter = s;
                if (!string.IsNullOrEmpty(s0))
                {
                    dv.RowFilter += string.Format(" and SpecialCardCode like '{0}*' ", s0);
                }
                if (!string.IsNullOrEmpty(s2))
                {
                    dv.RowFilter += string.Format(" and (FamilyName like '*{0}*' or Father like '*{0}*' or Mother Like '*{0}*' or Father like '*{1}*' or Mother Like '*{1}*' or Father like '*{2}*' or Mother Like '*{2}*' or Father like '*{3}*' or Mother Like '*{3}*' or Father like '*{4}*' or Mother Like '*{4}*' or Father like '*{5}*' or Mother Like '*{5}*' or Father like '*{6}*' or Mother Like '*{6}*' or Father like '*{7}*' or Mother Like '*{7}*' or Father like '*{8}*' or Mother Like '*{8}*' )", s2, s2.Replace('أ', 'ا'), s2.Replace('ا', 'أ'), s2.Replace('ى', 'ا'), s2.Replace('ا', 'ى'), s2.Replace('آ', 'ا'), s2.Replace('ا', 'آ'), s2.Replace('ة', 'ه'), s2.Replace('ه', 'ة'));
                }
                if (!string.IsNullOrEmpty(s3))
                {
                    dv.RowFilter += string.Format(" and (FatherNa like '{0}*' or MotherNa Like '{0}*')", s3);
                }
                //if (s4 != "0")
                //    dv.RowFilter += string.Format(" and IsCanceled = {0}", s4 == "1" ? 0 : 1);
                if (!string.IsNullOrEmpty(s4))
                {
                    dv.RowFilter += string.Format($" and SectorName like '{s4}'");
                }
                dt2 = dt2.DefaultView.ToTable();
            }
            catch { bw.CancelAsync(); }
        }
示例#29
0
 public static bool DeleteData(Basket_Item x)
 {
     Basket_Item.UpdateData(x);
     return(BaseDataBase._StoredProcedure("sp_Delete_Basket_Item"
                                          , new SqlParameter("@BasketID", x.Basket.Id)
                                          , new SqlParameter("@ItemID", x.RelatedItem.Id)));
 }
示例#30
0
        private void btnDelParent_Click(object sender, RoutedEventArgs e)
        {
            var x = this.DataContext as Parent;

            if (x.ParentrID != null)
            {
                if (!BaseDataBase.CurrentUser.CanDelete)
                {
                    MyMessageBox.Show("لا يوجد لديك صلاحيات للحذف");
                }
                else if (MyMessageBox.Show("هل تريد تأكيد حذف البيانات\n\nملاحظة:\nسيتم حذف كل من: المؤهلات، الحالة الصحية، الدورات التدريبية والأخوة للوالد", MessageBoxButton.YesNo) == MessageBoxResult.Yes && DBMain.DeleteData(x))
                {
                    BaseDataBase.MakeTabItemRed(this.Parent as TabItem);
                    MyMessage.DeleteMessage();
                    Parent p;
                    if (x.Gender == "ذكر")
                    {
                        p = new Father();
                    }
                    else
                    {
                        p = new Mother();
                    }
                    p.FamilyID       = x.FamilyID;
                    this.DataContext = p;
                }
            }
        }