Пример #1
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

            if (!Per.getPermission(userid, pageid, operationid))
            {
                Response.Redirect("~/BasicData/webHomePage.aspx");
            }
            try
            {
                if (string.IsNullOrEmpty(txtName.Text))
                {
                    Response.Write("<script>alert('من فضلك ادخل نوع المنتج')</script>");
                    return;
                }

                SaveData();
            }
            catch { }
        }
Пример #2
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(txtOrderNo.Text))
            {
                Response.Write("<script>alert('من فضلك تأكد من ادخال رقم الطلب')</script>");
                return;
            }

            ADAM.DataBase.ADAMConnectionString  mdb = new DataBase.ADAMConnectionString();
            ADAM.DataBase.ProductionHeaderOrder hdr = mdb.ProductionHeaderOrders.Single(a => a.ProductionNo == long.Parse(txtOrderNo.Text));
            txtDate.Text = hdr.ProductionDate.ToString("yyyy-MM-dd");

            gvProducionOrder.DataBind();
        }
Пример #3
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                ADAM.DataBase.ADAMConnectionString db = new DataBase.ADAMConnectionString();
                long      SupplierAccount             = db.SupplierDatas.Single(a => a.Id == long.Parse(ddlVendorName.SelectedValue)).AccountId;
                long      BoxAccount      = long.Parse(ddlBoxName.SelectedValue);
                csJournal csAddjournal    = new csJournal();
                long      JournalHeaderId = csAddjournal.InsertIntoJournalHeader(0, DateTime.Now, 15, "قيد فاتورة شراء", 0, long.Parse(hfSupplyheaderId.Value));
                csAddjournal.InsertIntoJournalDetails(SupplierAccount, long.Parse(ddlCostCenterName.SelectedValue), decimal.Parse(lblBillPrice.Text), 0, JournalHeaderId, "من حـ / المورد");
                csAddjournal.InsertIntoJournalDetails(BoxAccount, long.Parse(ddlCostCenterName.SelectedValue), 0, decimal.Parse(lblBillPrice.Text), JournalHeaderId, "الي حـ / الصندوق");
                ADAM.DataBase.SupplyOrderHeader SOHdr = db.SupplyOrderHeaders.Single(a => a.Id == long.Parse(hfSupplyheaderId.Value.ToString()));
                SOHdr.Posted = 1;
                db.SaveChanges();
            }
            catch { }
        }
Пример #4
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(txtCode.Text))
            {
                Response.Write("<script>alert('من فضلك ادخل الكود')</script>");
                return;
            }

            if (ddlItemType.SelectedValue == "0")
            {
                Response.Write("<script>alert('من فضلك اختر نوع الصنف')</script>");
                return;
            }
            txtCode.Enabled = false;
            ShowData();
        }
Пример #5
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                GetNum();
                if (ValidationData())
                {
                    ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString();
                    var RepCode = from a in Mdb.EmployeeDatas where a.Code == long.Parse(txtCode.Text) select a;
                    if (RepCode.Count() > 0)
                    {
                        Response.Write("<script>alert('لا يمكن تكرار الكود')</script>");
                        return;
                    }

                    SaveData();
                }
            }
            catch { }
        }
Пример #6
0
        protected void btnDelete_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 6;

            csGetPermission Per = new csGetPermission();

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

            ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString();
            ADAM.DataBase.RefluxDetailsData    ddr = mdb.RefluxDetailsDatas.Single(a => a.Id == long.Parse(RefluxDetailsId.Value));
            long HeaderId = ddr.RefluxHeaderId;

            mdb.RefluxDetailsDatas.Remove(ddr);
            mdb.SaveChanges();
            var Rows = from a in mdb.RefluxHeaderDatas where a.Id == HeaderId select a;

            if (Rows.Count() <= 0)
            {
                ADAM.DataBase.RefluxHeaderData dr = mdb.RefluxHeaderDatas.Single(a => a.Id == HeaderId);
                mdb.RefluxHeaderDatas.Remove(dr);
                mdb.SaveChanges();
            }
        }
Пример #7
0
        protected void btnShowReport_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 7;

            csGetPermission Per = new csGetPermission();

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

            ADAM.DataBase.ADAMConnectionString db = new DataBase.ADAMConnectionString();

            for (int Row = 0; Row < gvSupplyOrder.Rows.Count; Row++)
            {
                TextBox txtPrice = gvSupplyOrder.Rows[Row].FindControl("txtPrice") as TextBox;
                if (!string.IsNullOrEmpty(txtPrice.Text))
                {
                    long SupplyOrderDetailsId          = long.Parse(gvSupplyOrder.DataKeys[Row].Value.ToString());
                    ADAM.DataBase.SupplyOrderDetail dr = db.SupplyOrderDetails.Single(a => a.Id == SupplyOrderDetailsId);
                    dr.ItemPrice = decimal.Parse(txtPrice.Text);
                }
            }
            db.SaveChanges();
            gvSupplyOrder.DataBind();
        }
Пример #8
0
        protected void btnEdit_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 2;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                ADAM.DataBase.ADAMConnectionString mdb     = new DataBase.ADAMConnectionString();
                ADAM.DataBase.ItemContentDetail    details = mdb.ItemContentDetails.Single(a => a.Id == long.Parse(hfItemContentDetailsId.Value));

                details.ItemColorId         = int.Parse(ddlItemColor.SelectedValue);
                details.ItemContentHeaderId = long.Parse(hfItemContentHeaderId.Value);
                details.ItemId           = long.Parse(ddlItemName.SelectedValue);
                details.ItemTypeId       = long.Parse(ddlItemType.SelectedValue);
                details.ProductionLineId = long.Parse(ddlProductionLine.SelectedValue);
                details.Qty = decimal.Parse(txtQty.Text);

                mdb.SaveChanges();
                gvItemContentData.DataBind();
            }
            catch
            {
            }
        }
Пример #9
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                ADAM.DataBase.ADAMConnectionString db = new DataBase.ADAMConnectionString();
                ADAM.DataBase.JournalHeader        dr = db.JournalHeaders.Single(a => a.Id == long.Parse(gvJorunal.SelectedDataKey.Value.ToString()));
                dr.Posted = 1;
                db.SaveChanges();
                gvJorunal.DataBind();
                hfJournalHeaderId.Value = "0";
                gvJorunalDetails.DataBind();
            }
            catch { }
        }
Пример #10
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                GetNum();

                if (string.IsNullOrEmpty(txtRecordReceiptNo.Text))
                {
                    Response.Write("<script>alert('من فضلك ادخل رقم محضر الاستلام')</script>");
                    return;
                }

                if (string.IsNullOrEmpty(txtRecordReceiptDate.Text))
                {
                    Response.Write("<script>alert('من فضلك ادخل التاريخ')</script>");
                    return;
                }

                if (ddlItemType.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك اختر نوع الصنف')</script>");
                    return;
                }

                ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString();
                var RepCode = from a in Mdb.RecordReceiptHeaders where a.RecordReceiptNo == long.Parse(txtRecordReceiptNo.Text) select a;
                if (RepCode.Count() > 0)
                {
                    Response.Write("<script>alert('لا يمكن تكرار الكود')</script>");
                    return;
                }

                if (!CheckgvRecordReceipt())
                {
                    return;
                }
                else
                {
                    SaveData();
                }
            }
            catch { }
        }
Пример #11
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                GetNum();

                if (string.IsNullOrEmpty(txtSupplyOrderNo.Text))
                {
                    Response.Write("<script>alert('من فضلك ادخل رقم امر التوريد')</script>");
                    return;
                }

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

                if (ddlSupplier.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك ادخل المورد')</script>");
                    return;
                }

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

                ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString();
                var RepCode = from a in Mdb.SupplyOrderHeaders where a.SupplyOrderNo == long.Parse(txtSupplyOrderNo.Text) select a;
                if (RepCode.Count() > 0)
                {
                    Response.Write("<script>alert('لا يمكن تكرار رقم طلب التوريد')</script>");
                    return;
                }

                SaveData();
                gvSupplyOrder.DataBind();
            }
            catch { }
        }
Пример #12
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                GetNum();

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

                if (ddlItemType.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك ادخل نوع الصنف')</script>");
                    return;
                }

                if (ddlProductionLine.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك أختر خط الانتاج')</script>");
                    return;
                }

                if (string.IsNullOrEmpty(txtQty.Text) || decimal.Parse(txtQty.Text) <= 0)
                {
                    Response.Write("<script>alert('من فضلك أدخل الكميات بشكل صحيح')</script>");
                    return;
                }

                ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString();
                var RepCode = from a in Mdb.DeliveryDataHeaders where a.DeliveryNo == long.Parse(txtDeliveryOrderNo.Text) select a;
                if (RepCode.Count() > 0)
                {
                    Response.Write("<script>alert('لا يمكن تكرار رقم طلب التسليم')</script>");
                    return;
                }

                SaveData();
            }
            catch { }
        }
Пример #13
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                GetNum();
                if (string.IsNullOrEmpty(txtCode.Text))
                {
                    Response.Write("<script>alert('من فضلك ادخل كود المخزن')</script>");
                    return;
                }

                if (string.IsNullOrEmpty(txtName.Text))
                {
                    Response.Write("<script>alert('من فضلك ادخل اسم المخزن')</script>");
                    return;
                }

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

                if (string.IsNullOrEmpty(txtNote.Text))
                {
                    Response.Write("<script>alert('من فضلك ادخل الملاحظات')</script>");
                    return;
                }

                ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString();
                var RepCode = from a in Mdb.StoreDatas where a.Code == long.Parse(txtCode.Text) select a;
                if (RepCode.Count() > 0)
                {
                    Response.Write("<script>alert('لا يمكن تكرار الكود')</script>");
                    return;
                }

                SaveData();
            }
            catch { }
        }
Пример #14
0
        protected void gvSupplyOrder_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                if (string.IsNullOrEmpty(txtSupplyOrderNo.Text))
                {
                    Response.Write("<script>alert('من فضلك ادخل كود امر التوريد')</script>");
                    return;
                }

                TextBox txtQtyPrice  = gvSupplyOrder.SelectedRow.FindControl("txtQtyPrice") as TextBox;
                TextBox txtFQtyPrice = gvSupplyOrder.SelectedRow.FindControl("txtFQtyPrice") as TextBox;

                if (string.IsNullOrEmpty(txtFQtyPrice.Text))
                {
                    txtFQtyPrice.Text = "0";
                }

                if (string.IsNullOrEmpty(txtQtyPrice.Text) || decimal.Parse(txtQtyPrice.Text) == 0)
                {
                    Response.Write("<script>alert('من فضلك يجب ان يكون سعر الصنف اكبر من صفر')</script>");
                    return;
                }

                if (decimal.Parse(gvSupplyOrder.SelectedRow.Cells[10].Text) > 0)
                {
                    if (string.IsNullOrEmpty(txtFQtyPrice.Text) || decimal.Parse(txtFQtyPrice.Text) == 0)
                    {
                        Response.Write("<script>alert('من فضلك يجب ان يكون سعر tester اكبر من صفر')</script>");
                        return;
                    }
                }

                ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString();
                ADAM.DataBase.IncommingOrderData   dr  = mdb.IncommingOrderDatas.Single(a => a.Id == long.Parse(gvSupplyOrder.SelectedDataKey.Value.ToString()));
                dr.ItemPrice     = decimal.Parse(txtQtyPrice.Text);
                dr.FreeItemPrice = decimal.Parse(txtFQtyPrice.Text);
                mdb.SaveChanges();
            }
            catch { }
        }
Пример #15
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            ADAM.DataBase.ADAMConnectionString  mdb      = new DataBase.ADAMConnectionString();
            ADAM.DataBase.ProductionHeaderOrder headerdr = new DataBase.ProductionHeaderOrder();
            if (hfHeaderId.Value != "0")
            {
                headerdr = mdb.ProductionHeaderOrders.Single(a => a.Id == long.Parse(hfHeaderId.Value));
            }
            else
            {
                headerdr.ProductionDate = DateTime.Now;
                headerdr.ProductionNo   = long.Parse(txtOrderNo.Text);
                mdb.ProductionHeaderOrders.Add(headerdr);
                mdb.SaveChanges();
                hfHeaderId.Value = headerdr.Id.ToString();
            }

            for (int GRow = 0; GRow < gvProductionOrderData.Rows.Count; GRow++)
            {
                TextBox txtQty = gvProductionOrderData.Rows[GRow].FindControl("txtQty") as TextBox;
                if (!string.IsNullOrEmpty(txtQty.Text))
                {
                    if (decimal.Parse(txtQty.Text) <= 0)
                    {
                        Response.Write("<script>alert('من فضلك يجب ان تكون الكمية اكبر من الصفر')</script>");
                        return;
                    }

                    long ItemContentHeaderId = long.Parse(gvProductionOrderData.DataKeys[GRow].Value.ToString());

                    ADAM.DataBase.ProductionDetailsOrder detailsdr = new DataBase.ProductionDetailsOrder();
                    detailsdr.ProductionHeaderOrderId = long.Parse(hfHeaderId.Value);
                    detailsdr.ContentHeaderId         = ItemContentHeaderId;
                    detailsdr.Qty    = decimal.Parse(txtQty.Text);
                    detailsdr.Status = 0;
                    mdb.ProductionDetailsOrders.Add(detailsdr);
                }
            }
            mdb.SaveChanges();
            btnNew_Click(sender, e);
        }
Пример #16
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                if (ddlItemColor.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك اختر لون الصنف')</script>");
                    return;
                }

                if (ddlProdctionLine.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك أختر خط الانتاج')</script>");
                    return;
                }

                if (ddlItems.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك أختر الصنف')</script>");
                    return;
                }

                if (ddlItemType.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك أختر المخزن')</script>");
                    return;
                }

                ADAM.DataBase.ADAMConnectionString Mdb = new DataBase.ADAMConnectionString();
                var RepCode = from a in Mdb.ItemColorSelecteds where a.ItemId == long.Parse(ddlItems.SelectedValue) && a.ItemColorId == long.Parse(ddlItemColor.SelectedValue) select a;

                if (RepCode.Count() > 0)
                {
                    Response.Write("<script>alert('لقد تم ادخال هذا اللون لهذا الصنف من قبل')</script>");
                    return;
                }

                SaveData();
            }
            catch { }
        }
Пример #17
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(txtOrderNo.Text))
            {
                Response.Write("<script>alert('من فضلك تأكد من ادخال رقم الطلب')</script>");
                return;
            }

            ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString();
            var Row = from a in mdb.ProductionHeaderOrders where a.ProductionNo == long.Parse(txtOrderNo.Text) select a;

            if (Row.Count() > 0)
            {
                ADAM.DataBase.ProductionHeaderOrder headerdr = mdb.ProductionHeaderOrders.Single(a => a.ProductionNo == long.Parse(txtOrderNo.Text));
                hfHeaderId.Value = headerdr.Id.ToString();
                txtDate.Text     = headerdr.ProductionDate.ToString("yyyy-MM-dd");

                for (int GRow = 0; GRow < gvProductionOrderData.Rows.Count; GRow++)
                {
                    TextBox txtQty = gvProductionOrderData.Rows[GRow].FindControl("txtQty") as TextBox;
                    long    ItemContentHeaderId = long.Parse(gvProductionOrderData.DataKeys[GRow].Value.ToString());

                    var dRows = from a in mdb.ProductionDetailsOrders
                                where a.ContentHeaderId == ItemContentHeaderId &&
                                a.ProductionHeaderOrderId == long.Parse(hfHeaderId.Value)
                                select a;
                    if (dRows.Count() > 0)
                    {
                        ADAM.DataBase.ProductionDetailsOrder ddr = mdb.ProductionDetailsOrders.Single(a => a.ContentHeaderId == ItemContentHeaderId &&
                                                                                                      a.ProductionHeaderOrderId == long.Parse(hfHeaderId.Value));
                        txtQty.Text = ddr.Qty.ToString();
                    }
                }
            }
            else
            {
                Response.Write("<script>alert('من فضلك تأكد من رقم الطلب')</script>");
                return;
            }
        }
Пример #18
0
        protected void btnEditOrderItem_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                if (Session["UserID"] == null)
                {
                    Response.Redirect("~/BasicData/webLogIn.aspx");
                }
                int userid      = int.Parse(Session["UserID"].ToString());
                int operationid = 2;

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

                ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString();
                ADAM.DataBase.RefluxDetailsData    ddr = mdb.RefluxDetailsDatas.Single(a => a.Id == long.Parse(RefluxDetailsId.Value));
                if (ddr.RefluxHeaderData.OrderType == 1)
                {
                    ADAM.DataBase.PurchaseOredrDetail purchasedr = mdb.PurchaseOredrDetails.Single(a => a.Id == ddr.ExchangeOrPurchaseDetailsId);
                    if (decimal.Parse(txtQty.Text) > purchasedr.ConformQty)
                    {
                        Response.Write("<script>alert('لا يمكن ان تكون الكمية المرتجعة اكبر من الكمية الموجوده في طلب الشراء')</script>");
                        return;
                    }
                }

                if (ddr.RefluxHeaderData.OrderType == 2)
                {
                    ADAM.DataBase.ExchangeRequestDetailsData detailsdr = mdb.ExchangeRequestDetailsDatas.Single(a => a.Id == ddr.ExchangeOrPurchaseDetailsId);
                    if (decimal.Parse(txtQty.Text) > detailsdr.Qty)
                    {
                        Response.Write("<script>alert('لا يمكن ان تكون الكمية المرتجعة اكبر من الكمية الموجوده في طلب الصرف')</script>");
                        return;
                    }

                    if (decimal.Parse(txtFreeQty.Text) > detailsdr.FreeQty)
                    {
                        Response.Write("<script>alert('لا يمكن ان تكون الكمية المجانية المرتجعة اكبر من الكمية الموجوده في طلب الصرف')</script>");
                        return;
                    }
                }

                ddr.RefluxQty     = decimal.Parse(txtQty.Text);
                ddr.RefluxFreeQty = decimal.Parse(txtFreeQty.Text);

                mdb.SaveChanges();
                gvReflux.DataBind();
            }
            catch { }
        }
Пример #19
0
        protected void btnEdit_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
                Response.Redirect("~/BasicData/webLogIn.aspx");
            int userid = int.Parse(Session["UserID"].ToString());
            int operationid = 2;

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

            EditData();
        }
Пример #20
0
        private void SaveData(string Qty, long ItemId, int ItemColorId)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            ADAM.DataBase.ADAMConnectionString mdb = new DataBase.ADAMConnectionString();
            if (hfItemContentHeaderId.Value == "0")
            {
                ADAM.DataBase.ItemContentHeader Hdr = new DataBase.ItemContentHeader();

                Hdr.ProductionLineId = long.Parse(ddlProductProductionLine.SelectedValue);
                Hdr.ProductItemColor = int.Parse(ddlProductionItemcolor.SelectedValue);
                Hdr.ProductItemId    = long.Parse(ddlProductionItem.SelectedValue);
                Hdr.ItemType         = int.Parse(ddlProductionItemType.SelectedValue);

                mdb.ItemContentHeaders.Add(Hdr);
                mdb.SaveChanges();
                hfItemContentHeaderId.Value = Hdr.Id.ToString();
            }

            var Rows = from a in mdb.ItemContentDetails where a.ItemId == ItemId && a.ItemColorId == ItemColorId select a;

            if (Rows.Count() > 0)
            {
                Response.Write("<script>alert('لا يمكن ادخال نفس الصنف واللون اكثر من مرة في التركيبة الواحدة')</script>");
                return;
            }

            ADAM.DataBase.ItemContentDetail ddr = new DataBase.ItemContentDetail();
            ddr.ItemColorId         = ItemColorId;
            ddr.ItemContentHeaderId = long.Parse(hfItemContentHeaderId.Value);
            ddr.ItemId           = ItemId;
            ddr.ItemTypeId       = long.Parse(ddlItemType.SelectedValue);
            ddr.ProductionLineId = long.Parse(ddlProductionLine.SelectedValue);
            ddr.Qty = decimal.Parse(Qty);

            mdb.ItemContentDetails.Add(ddr);
            mdb.SaveChanges();
            gvItemContentData.DataBind();
        }
Пример #21
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

            if (!Per.getPermission(userid, pageid, operationid))
            {
                Response.Redirect("~/BasicData/webHomePage.aspx");
            }
            try
            {
                if (ddlPages.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك اختر الشاشة')</script>");
                    return;
                }

                if (ddlOperation.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك اختر الصلاحية')</script>");
                    return;
                }

                if (ddlUser.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك اختر المستخدم')</script>");
                    return;
                }

                ADAM.DataBase.ADAMConnectionString Mdb = new ADAM.DataBase.ADAMConnectionString();
                var RepCode = from a in Mdb.Permissions
                              where a.OperationId == long.Parse(ddlOperation.SelectedValue) &&
                              a.PageId == long.Parse(ddlPages.SelectedValue) && a.UserId == long.Parse(ddlUser.SelectedValue)
                              select a;
                if (RepCode.Count() > 0)
                {
                    Response.Write("<script>alert('لقد تم تسجيل هذه الصلاحية من قبل')</script>");
                    return;
                }

                SaveData();
                gvUserPermission.DataBind();
            }
            catch { }
        }
Пример #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 5;

            csGetPermission Per = new csGetPermission();

            if (!Per.getPermission(userid, pageid, operationid))
            {
                Response.Redirect("~/BasicData/webHomePage.aspx");
            }
        }
Пример #23
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();
            }
        }
Пример #24
0
        protected void btnEdit_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 2;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                if (ddlItemColor.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك اختر لون الصنف')</script>");
                    return;
                }

                if (ddlProdctionLine.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك أختر خط الانتاج')</script>");
                    return;
                }

                if (ddlItems.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك أختر الصنف')</script>");
                    return;
                }

                if (ddlItemType.SelectedValue == "0")
                {
                    Response.Write("<script>alert('من فضلك أختر المخزن')</script>");
                    return;
                }

                EditData();
            }
            catch { }
        }
Пример #25
0
        protected void btnShowReport_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 5;

            csGetPermission Per = new csGetPermission();

            if (!Per.getPermission(userid, pageid, operationid))
            {
                Response.Redirect("~/BasicData/webHomePage.aspx");
            }
            Response.Redirect("~/MainReport/webJobsReport.aspx");
        }
Пример #26
0
        protected void btnSaveOrderItem_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                ADAM.DataBase.ADAMConnectionString mdb     = new DataBase.ADAMConnectionString();
                ADAM.DataBase.ItemContentDetail    details = new DataBase.ItemContentDetail();

                var Rows = from a in mdb.ItemContentDetails where a.ItemId == long.Parse(ddlItemName.SelectedValue) &&
                           a.ItemColorId == long.Parse(ddlItemColor.SelectedValue) select a;
                if (Rows.Count() > 0)
                {
                    Response.Write("<script>alert('لا يمكن ادخال نفس الصنف واللون اكثر من مرة في التركيبة الواحدة')</script>");
                    return;
                }


                details.ItemColorId         = int.Parse(ddlItemColor.SelectedValue);
                details.ItemContentHeaderId = long.Parse(hfItemContentHeaderId.Value);
                details.ItemId           = long.Parse(ddlItemName.SelectedValue);
                details.ItemTypeId       = long.Parse(ddlItemType.SelectedValue);
                details.ProductionLineId = long.Parse(ddlProductionLine.SelectedValue);
                details.Qty = decimal.Parse(txtQty.Text);

                mdb.ItemContentDetails.Add(details);
                mdb.SaveChanges();
                gvItemContentData.DataBind();
            }
            catch
            {
            }
        }
Пример #27
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            try
            {
                ADAM.DataBase.ADAMConnectionString db = new DataBase.ADAMConnectionString();

                long SalesCost    = db.AccountHelpers.Single(a => a.Id == 2).AccountId;
                long StoreAccount = db.ItemTypes.Single(a => a.Id == db.ExchangeRequestDetailsDatas.Single(aa => aa.ExchangeRequestHeaderDataId == long.Parse(hfExchangeheaderId.Value.ToString())).ItemTypeId).AccountId;


                long ClientAccount = db.ClientDatas.Single(a => a.Id == long.Parse(ddlClient.SelectedValue)).AccountId;
                long SalesAccount  = db.AccountHelpers.Single(a => a.Id == 1).AccountId;

                csJournal csAddjournal    = new csJournal();
                long      JournalHeaderId = csAddjournal.InsertIntoJournalHeader(0, DateTime.Now, int.Parse(ddlExchangeRequestType.SelectedValue), "قيد فاتورة بيع", 0, long.Parse(hfExchangeheaderId.Value));

                csAddjournal.InsertIntoJournalDetails(SalesAccount, long.Parse(ddlCostCenterName.SelectedValue), decimal.Parse(ViewState["AllItemCost"].ToString()), 0, JournalHeaderId, "من حـ / تكلفة المبيعات");
                csAddjournal.InsertIntoJournalDetails(StoreAccount, long.Parse(ddlCostCenterName.SelectedValue), 0, decimal.Parse(ViewState["AllItemCost"].ToString()), JournalHeaderId, "الي حـ / المخزن");

                csAddjournal.InsertIntoJournalDetails(ClientAccount, long.Parse(ddlCostCenterName.SelectedValue), decimal.Parse(lblBillPrice.Text), 0, JournalHeaderId, "من حـ / العميل");
                csAddjournal.InsertIntoJournalDetails(SalesAccount, long.Parse(ddlCostCenterName.SelectedValue), 0, decimal.Parse(lblBillPrice.Text), JournalHeaderId, "الي حـ / المبيعات");

                ADAM.DataBase.ExchangeRequestHeaderData ERHdr = db.ExchangeRequestHeaderDatas.Single(a => a.Id == long.Parse(hfExchangeheaderId.Value));
                ERHdr.Posted = 1;
                db.SaveChanges();

                hfExchangeheaderId.Value = "0";
                gvExchangeData.DataBind();
            }
            catch { }
        }
Пример #28
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Response.Redirect("~/BasicData/webLogIn.aspx");
            }
            int userid      = int.Parse(Session["UserID"].ToString());
            int operationid = 1;

            csGetPermission Per = new csGetPermission();

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

            if (string.IsNullOrEmpty(txtDebit.Text) || txtDebit.Text == "0")
            {
                if (string.IsNullOrEmpty(txtCredit.Text) || txtCredit.Text == "0")
                {
                    Response.Write("<script>alert('من فضلك تأكد من أدخال قيمة في المدين او الدائن')</script>");
                    return;
                }
            }

            if (string.IsNullOrEmpty(txtCredit.Text) || txtCredit.Text == "0")
            {
                if (string.IsNullOrEmpty(txtDebit.Text) || txtDebit.Text == "0")
                {
                    Response.Write("<script>alert('من فضلك تأكد من أدخال قيمة في المدين او الدائن')</script>");
                    return;
                }
            }

            BasicData.csJournal InsertJournal = new csJournal();
            if (hfJournalHeaderId.Value == "0")
            {
                long JournalHeaderId = InsertJournal.InsertIntoJournalHeader(long.Parse(txtjournalCode.Text), DateTime.Parse(txtjournalDate.Text), int.Parse(ddlJournaType.SelectedValue), txtJournalNote.Text, 0, 0);
                hfJournalHeaderId.Value = JournalHeaderId.ToString();
            }

            InsertJournal.InsertIntoJournalDetails(long.Parse(ddlAccountName.SelectedValue), long.Parse(ddlCostCenter.SelectedValue), decimal.Parse(txtDebit.Text), decimal.Parse(txtCredit.Text), long.Parse(hfJournalHeaderId.Value), txtNote.Text);
            gvJournalDetails.DataBind();
            EmpData();
        }
Пример #29
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");
            }

            txtCode.Enabled = false;
            ShowData();
        }
Пример #30
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");
            }

            ShowData(int.Parse(ddlRefluxType.SelectedValue));
            btnGetExchageNo.Visible = false;
        }