예제 #1
0
 private void DeleteData()
 {
     try
     {
         ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString();
         ADAM.DataBase.Department           dr  = Mdb.Departments.Single(a => a.Code == long.Parse(txtCode.Text));
         var DivisionRows = from a in Mdb.divisions where a.DepartmentId == dr.Id select a;
         if (DivisionRows.Count() > 0)
         {
             Response.Write("<script>alert('لا يمكن حذف الادارة لوجود اقسام تابعه لها')</script>");
             return;
         }
         var EmployeeRows = from a in Mdb.EmployeeDatas where a.DepartmentId == dr.Id select a;
         if (EmployeeRows.Count() > 0)
         {
             Response.Write("<script>alert('لا يمكن الحذف لوجود موظفين مرتبطين بها')</script>");
             return;
         }
         Mdb.Departments.Remove(dr);
         Mdb.SaveChanges();
         txtName.Text = txtCode.Text = "";
         Response.Write("<script>alert('تمت عملية الحذف نجاح')</script>");
     }
     catch { Response.Write("<script>alert('خطأ أثناء الحذف من فضلك تأكد من ادخال البيانات بشكل صحيح او من الاتصال بقاعدة البيانات')</script>"); }
 }
예제 #2
0
        private void EditData()
        {
            try
            {
                if (string.IsNullOrEmpty(txtCode.Text) || string.IsNullOrEmpty(txtName.Text))
                {
                    Response.Write("<script>alert('من فضلك تأكد من ادخال كل البيانات بشكل صحيح')</script>");
                    return;
                }
                ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString();
                ADAM.DataBase.Department           dr  = Mdb.Departments.Single(a => a.Code == long.Parse(txtCode.Text));

                if (Validation())
                {
                    dr.Name = txtName.Text;
                    Mdb.SaveChanges();
                    Response.Write("<script>alert('تمت عملية التعديل بنجاح')</script>");
                }
                else
                {
                    Response.Write("<script>alert('هذا الكود غير موجود بقاعدة البيانات')</script>");
                }
            }
            catch { Response.Write("<script>alert('خطأ أثناء التعديل من فضلك تأكد من ادخال البيانات بشكل صحيح او الاتصال بقاعدة البيانات ')</script>"); }
        }
예제 #3
0
        private void ShowData()
        {
            try
            {
                ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString();
                var Rows = from a in Mdb.DirectSellDatas where a.DirectSellNo == long.Parse(txtDirectSellOrderNo.Text) select a;
                if (Rows.Count() > 0)
                {
                    #region ShowHeader
                    ADAM.DataBase.DirectSellData dr = Mdb.DirectSellDatas.Single(a => a.DirectSellNo == long.Parse(txtDirectSellOrderNo.Text));
                    txtDirectSellOrderNo.Text = dr.DirectSellNo.ToString();
                    txtDate.Text = dr.DirectSellDate.ToString("yyyy-MM-dd");
                    ADAM.DataBase.EmployeeData Empdr = Mdb.EmployeeDatas.Single(a => a.Id == dr.EmpId);
                    ADAM.DataBase.division     divdr = Mdb.divisions.Single(a => a.Id == Empdr.DivisionId);
                    ADAM.DataBase.Department   depId = Mdb.Departments.Single(a => a.Id == divdr.DepartmentId);

                    ddlDepartment.SelectedValue = depId.Id.ToString();
                    ddlDivision.DataBind();
                    ddlDivision.SelectedValue = divdr.Id.ToString();
                    ddlEmployee.DataBind();
                    ddlEmployee.SelectedValue = dr.EmpId.ToString();
                    ddlItemType.SelectedValue = dr.ItemType.ToString();
                    hfId.Value          = dr.Id.ToString();
                    ddlItemType.Enabled = false;
                    #endregion
                    gvPurchaseDetailsData.DataBind();
                }
                else
                {
                    Response.Write("<script>alert('من فضلك تأكد من رقم طلب الشراء')</script>");
                }
            }
            catch { Response.Write("<script>alert('خطأ أثناء عرض البيانات من فضلك تأكد من الكود او من الاتصال بقاعدة البيانات')</script>"); }
        }
예제 #4
0
        private void GetNum()
        {
            ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString();
            var Rows = from a in mdb.Departments orderby a.Id descending select a;

            if (Rows.Count() == 0)
            {
                txtCode.Text = "1";
            }
            else
            {
                ADAM.DataBase.Department dr = Rows.First();
                txtCode.Text = (dr.Code + 1).ToString();
            }
        }
예제 #5
0
        protected void btnShowData_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 3;

            csGetPermission Per = new csGetPermission();

            if (!Per.getPermission(userid, pageid, operationid))
            {
                Response.Redirect("~/BasicData/webHomePage.aspx");
            }

            if (string.IsNullOrEmpty(txtExchangeRequestNo.Text))
            {
                Response.Write("<script>alert('من فضلك ادخل رقم طلب الصرف')</script>");
                return;
            }

            txtExchangeRequestNo.Enabled = false;

            ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString();
            var HRows = from a in mdb.ExchangeRequestHeaderDatas
                        where a.OrderType == int.Parse(ddlExchangeRequestType.SelectedValue) &&
                        a.ExchangeRequestNo == int.Parse(txtExchangeRequestNo.Text)
                        select a;

            if (HRows.Count() > 0)
            {
                ADAM.DataBase.ExchangeRequestHeaderData Hdr = mdb.ExchangeRequestHeaderDatas.Single(a => a.ExchangeRequestNo == int.Parse(txtExchangeRequestNo.Text) &&
                                                                                                    a.OrderType == int.Parse(ddlExchangeRequestType.SelectedValue));
                hfId.Value = Hdr.Id.ToString();
                ddlClient.SelectedValue = Hdr.ClientId.ToString();
                ADAM.DataBase.division   Ddr   = mdb.divisions.Single(a => a.Id == Hdr.DivisionId);
                ADAM.DataBase.Department Depdr = mdb.Departments.Single(a => a.Id == Ddr.DepartmentId);
                ddlDepartment.SelectedValue = Depdr.Id.ToString();
                ddlDivision.DataBind();
                ddlDivision.SelectedValue = Ddr.Id.ToString();
                ddlEmployee.DataBind();
                ddlEmployee.SelectedValue = Hdr.EmpId.ToString();
                txtDate.Text = Hdr.ExchangeRequestDate.ToString("yyyy-MM-dd");
                //gvExchangeRequestData.DataBind();
            }
        }
예제 #6
0
 private void ShowData()
 {
     try
     {
         ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString();
         var Rows = from a in Mdb.Departments where a.Code == long.Parse(txtCode.Text) select a;
         if (Rows.Count() > 0)
         {
             ADAM.DataBase.Department dr = Mdb.Departments.Single(a => a.Code == long.Parse(txtCode.Text));
             txtName.Text = dr.Name;
         }
         else
         {
             Response.Write("<script>alert('من فضلك تأكد من كود الادارة')</script>");
         }
     }
     catch { Response.Write("<script>alert('خطأ أثناء عرض البيانات من فضلك تأكد من الكود او من الاتصال بقاعدة البيانات')</script>"); }
 }
예제 #7
0
        protected void btnShowData_Click(object sender, ImageClickEventArgs e)
        {
            if (string.IsNullOrEmpty(txtExchangeRequestNo.Text))
            {
                Response.Write("<script>alert('من فضلك ادخل رقم طلب الصرف')</script>");
                return;
            }

            txtExchangeRequestNo.Enabled = false;

            ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString();
            var HRows = from a in mdb.ExchangeRequestHeaderDatas
                        where  a.OrderType == int.Parse(ddlExchangeRequestType.SelectedValue) && a.ExchangeRequestNo == int.Parse(txtExchangeRequestNo.Text)
                        select a;

            if (HRows.Count() > 0)
            {
                ADAM.DataBase.ExchangeRequestHeaderData Hdr = mdb.ExchangeRequestHeaderDatas.Single(a => a.ExchangeRequestNo == int.Parse(txtExchangeRequestNo.Text) &&
                                                                                                    a.OrderType == int.Parse(ddlExchangeRequestType.SelectedValue));

                hfId.Value = Hdr.Id.ToString();
                ADAM.DataBase.ClientData client = mdb.ClientDatas.Single(a => a.Id == Hdr.ClientId);
                ADAM.DataBase.division   Ddr    = mdb.divisions.Single(a => a.Id == Hdr.DivisionId);
                ADAM.DataBase.Department Depdr  = mdb.Departments.Single(a => a.Id == Ddr.DepartmentId);
                ddlDepartment.SelectedValue = Depdr.Id.ToString();
                ddlDivision.DataBind();
                ddlDivision.SelectedValue = Ddr.Id.ToString();
                ddlEmployee.DataBind();
                ddlEmployee.SelectedValue = Hdr.EmpId.ToString();
                txtDate.Text          = Hdr.ExchangeRequestDate.ToString("yyyy-MM-dd");
                txtClientAddress.Text = client.Address;
                txtClientMob.Text     = client.FirstMobile;
                txtClientName.Text    = client.FirstName + " " + client.LastName;
                txtClientPhone.Text   = client.FirstPhone;

                gvExchangeRequestData.DataBind();
            }
        }