public void FilterGet(int iDisplayLength, int iDisplayStart, int iSortCol_0, string sSortDir_0, string sSearch, string sSearch_0, string sSearch_1, string sSearch_2, string sSearch_3, string sSearch_4, string sSearch_5, string sSearch_6, string sSearch_7, string min, string max)
        {
            int filteredCount = 0;

            List<Rejection> RejectionList = new List<Rejection>();

            DataTable dt = Rejection_DA.Filter_Get_Rejection(iDisplayLength, iDisplayStart, iSortCol_0, sSortDir_0, sSearch, sSearch_0, sSearch_1, sSearch_2, sSearch_3, sSearch_4, sSearch_5, sSearch_6, sSearch_7, min, max);

            foreach (DataRow row in dt.Rows)
            {
                filteredCount = int.Parse(row["TotalCount"].ToString());

                Rejection _Rejection = new Rejection();

                _Rejection.Order_No = row["Order_No"].ToString();
                _Rejection.Name = row["Name"].ToString();
                _Rejection.No = int.Parse(row["No"].ToString());
                _Rejection.Pairs = int.Parse(row["Pairs"].ToString());

                _Rejection.Left = int.Parse(row["Left"].ToString());
                _Rejection.Right = int.Parse(row["Right"].ToString());

                _Rejection.DateString = Convert.ToDateTime(row["Date"].ToString()).ToShortDateString();
                _Rejection.Description = row["Description"].ToString();

                _Rejection.ForEdit = int.Parse(row["Id"].ToString());
                _Rejection.ForDelete = int.Parse(row["Id"].ToString());

                RejectionList.Add(_Rejection);

            }
            var result = new
            {
                iTotalRecords = GetTotalCount(),
                iTotalDisplayRecords = filteredCount,
                aaData = RejectionList
            };

            JavaScriptSerializer js = new JavaScriptSerializer();
            Context.Response.Write(js.Serialize(result));
        }
        public Rejection Get(int Id)
        {
            Rejection _Rejection = new Rejection();

            DataTable dt = Rejection_DA.Get_Rejection_By_ID(Id);

            foreach (DataRow row in dt.Rows)
            {

                _Rejection.Id = Id;
                _Rejection.Order_ID = int.Parse(row["Order_ID"].ToString());

                _Rejection.Style_ID = int.Parse(row["Style_ID"].ToString());
                _Rejection.Size_ID = int.Parse(row["Size_ID"].ToString());
                _Rejection.Pairs = int.Parse(row["Pairs"].ToString());
                _Rejection.Left = int.Parse(row["Left"].ToString());
                _Rejection.Right = int.Parse(row["Right"].ToString());
                _Rejection.DateString = Convert.ToDateTime(row["Date"].ToString()).ToShortDateString();
                _Rejection.Description = row["Description"].ToString();
                //_Order.No_Order_Rem = no_Order_Rem;

            }
            return _Rejection;
        }
        public string GetPairs(int Order_ID, int Style_ID, int Size_ID)
        {
            Rejection _Rejection = new Rejection();

            _Rejection.Order_ID = Order_ID;
            _Rejection.Style_ID = Style_ID;
            _Rejection.Size_ID = Size_ID;

            DataTable dt = Rejection_DA.Get_Pairs_SUM_From_Stitching(_Rejection);

            return dt.Rows[0][0].ToString();
        }
        public string Update(int Id, int Order_ID, int Style_ID, int Size_ID, int Pairs, int Left, int Right, string Date, string Description)
        {
            Rejection _Rejection = new Rejection();
            _Rejection.Id = Id;
            _Rejection.Order_ID = Order_ID;
            _Rejection.Style_ID = Style_ID;
            _Rejection.Size_ID = Size_ID;
            _Rejection.Pairs = Pairs;
            _Rejection.Left = Left;
            _Rejection.Right = Right;
            _Rejection.Date = Convert.ToDateTime(Date);
            _Rejection.Description = Description;

            return Rejection_DA.UpdateRejection(_Rejection);
        }
        //protected bool ValidatePage()
        //{
        //    bool flag = true;
        //    lblMessage.Text = "";
        //    #region Packing
        //    Packing _Packing = new Packing();
        //    _Packing.Employee_ID = int.Parse(ddlPacker.SelectedValue);
        //    _Packing.Order_ID = int.Parse(ddlOrderNo.SelectedValue);
        //    _Packing.Style_ID = int.Parse(ddlStyle.SelectedValue);
        //    _Packing.Size_ID = int.Parse(ddlSize.SelectedValue);
        //    _Packing.Pairs_Packed = int.Parse(txtPairs.Text);
        //    #endregion
        //    validatingPairs(ref flag, ref _Packing);
        //    if (flag == false)
        //        lblMessage.ForeColor = System.Drawing.Color.Red;
        //    else
        //        lblMessage.ForeColor = System.Drawing.Color.Green;
        //    return flag;
        //}
        //protected void validatingPairs(ref bool flag, ref Packing _Packing)
        //{
        //    DataTable dt = Packing_DA.Get_Pairs_SUM_From_Stitching(_Packing);
        //    if (dt.Rows.Count > 0)
        //    {
        //        if (_Packing.Pairs_Packed > int.Parse(dt.Rows[0][0].ToString()))
        //        {
        //            lblMessage.Text += "USing More Pairs then Have </br>";
        //            flag = false;
        //        }
        //    }
        //}
        protected void InsertRejection()
        {
            #region Rejection
            Rejection _Rejection = new Rejection();

            //_Rejection.Cutter_ID = int.Parse(ddlCutter.SelectedValue);
            //_Rejection.Stitcher_ID = int.Parse(ddlStitcher.SelectedValue);

            _Rejection.Order_ID = int.Parse(ddlOrderNo.SelectedValue);
            _Rejection.Style_ID = int.Parse(ddlStyle.SelectedValue);
            _Rejection.Size_ID = int.Parse(ddlSize.SelectedValue);
            _Rejection.Pairs = int.Parse(txtPairs.Text);
            if (txtLeft.Text != "" )
            {
                _Rejection.Left = int.Parse(txtLeft.Text);
            }
            if (txtRight.Text != "")
            {
                _Rejection.Right = int.Parse(txtRight.Text);
            }

            _Rejection.Date = Convert.ToDateTime(txtDate.Text);
            _Rejection.Description = txtDescription.Text;
            _Rejection.IsDeleted = false;
            #endregion

            lblMessage.Text = Rejection_DA.InsertRejection(_Rejection);

            lblMessage.ForeColor = System.Drawing.Color.Green;
        }
        protected void Fill_PairsBox()
        {
            if (ddlOrderNo.SelectedValue != "" && ddlSize.SelectedValue != "" && ddlStyle.SelectedValue != "")
            {
                Rejection _Rejection = new Rejection();

                _Rejection.Order_ID = int.Parse(ddlOrderNo.SelectedValue);

                _Rejection.Style_ID = int.Parse(ddlStyle.SelectedValue);

                _Rejection.Size_ID = int.Parse(ddlSize.SelectedValue);

                DataTable dt = Rejection_DA.Get_Pairs_SUM_From_Stitching(_Rejection);

                if (dt.Rows.Count > 0)
                {
                    txtPairs.Text = dt.Rows[0][0].ToString();
                }
                else
                {
                    txtPairs.Text = "";
                }

                //FillCutter(_Rejection);
                //FillStitcher(_Rejection);

                //divEmployees.Visible = true;
            }
        }
Ejemplo n.º 7
0
        public static string UpdateRejection(Rejection _Rejection)
        {
            DbCommand command = Catalog_Access.CreateCommand();
            command.CommandText = "sp_UpdateRejection";

            DbParameter param;

            param = command.CreateParameter();
            param.ParameterName = "@Id";
            param.Value = _Rejection.Id;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Order_ID";
            param.Value = _Rejection.Order_ID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Style_ID";
            param.Value = _Rejection.Style_ID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Size_ID";
            param.Value = _Rejection.Size_ID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Pairs";
            param.Value = _Rejection.Pairs;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Left";
            param.Value = _Rejection.Left;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Right";
            param.Value = _Rejection.Right;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Date";
            param.Value = _Rejection.Date;
            param.DbType = DbType.Date;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Description";
            param.Value = _Rejection.Description;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Return";
            param.DbType = DbType.String;
            param.Size = 2;
            param.Direction = ParameterDirection.Output;
            command.Parameters.Add(param);

            Catalog_Access.ExecuteNonQuery(command);

            string Return = command.Parameters["@Return"].Value.ToString();

            return Return;
        }
Ejemplo n.º 8
0
        public static string InsertRejection(Rejection _Rejection)
        {
            DbCommand command = Catalog_Access.CreateCommand();
            command.CommandText = "sp_InsertRejection";

            DbParameter param;

            //param = command.CreateParameter();
            //param.ParameterName = "@Cutter_ID";
            //param.Value = _Rejection.Cutter_ID;
            //param.DbType = DbType.Int32;
            //command.Parameters.Add(param);

            //param = command.CreateParameter();
            //param.ParameterName = "@Stitcher_ID";
            //param.Value = _Rejection.Stitcher_ID;
            //param.DbType = DbType.Int32;
            //command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Order_ID";
            param.Value = _Rejection.Order_ID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Style_ID";
            param.Value = _Rejection.Style_ID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Size_ID";
            param.Value = _Rejection.Size_ID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Pairs";
            param.Value = _Rejection.Pairs;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Right";
            param.Value = _Rejection.Right;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Left";
            param.Value = _Rejection.Left;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Date";
            param.Value = _Rejection.Date;
            param.DbType = DbType.Date;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Description";
            param.Value = _Rejection.Description;
            param.DbType = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@IsDeleted";
            param.Value = _Rejection.IsDeleted;
            param.DbType = DbType.Boolean;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Return";
            param.DbType = DbType.String;
            param.Size = 2;
            param.Direction = ParameterDirection.Output;
            command.Parameters.Add(param);

            Catalog_Access.ExecuteNonQuery(command);

            string Return = command.Parameters["@Return"].Value.ToString();

            if (Return == Constants.SP_ALREADY_EXIST)
            {
                return Constants.ALREADY_EXIST;
            }
            else
            {
                return Constants.SUCESS_INSERT;
            }
        }
Ejemplo n.º 9
0
        /// Working right now
        /// 
        /// </summary>
        /// <param name="_Packing"></param>
        /// <returns></returns>
        public static DataTable Get_Pairs_SUM_From_Stitching(Rejection _Rejection)
        {
            DbCommand command = Catalog_Access.CreateCommand();
            command.CommandText = "sp_Get_Pairs_SUM_From_Stitching_For_Rejection";

            DbParameter param;

            param = command.CreateParameter();
            param.ParameterName = "@OrderId";
            param.Value = _Rejection.Order_ID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@StyleId";
            param.Value = _Rejection.Style_ID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@SizeId";
            param.Value = _Rejection.Size_ID;
            param.DbType = DbType.Int32;
            command.Parameters.Add(param);

            return Catalog_Access.ExecuteSelectCommand(command);
        }