Exemple #1
0
        protected void cmbMonth_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbYear.Text != "-Select-" && lblGetAssemblyTypeId.Text != null)
            {
                DataTable dtable = new DataTable();
                dtable = VehicleOrderRepository.GetDay(Convert.ToInt32(cmbMonth.Value), cmbYear.Text);
                GetDay(dtable); // bind day

                DataSet ds = VehicleOrderRepository.GetVPCStorageByMonthYear(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.Value), Convert.ToInt32(lblGetAssemblyTypeId.Value));
                grid.DataSource     = null;
                grid.DataSourceID   = null;
                grid.DataSource     = ds.Tables[0];
                Session["GridData"] = ds.Tables[0];
                grid.DataBind();
            }
            else
            {
                DataTable dtable = new DataTable();
                dtable = VehicleOrderRepository.GetDay(Convert.ToInt32(cmbMonth.Value), cmbYear.Text);
                GetDay(dtable); // bind day

                DataSet ds = VehicleOrderRepository.GetVPCStorageByMonth(Convert.ToInt32(cmbMonth.Value), Convert.ToInt32(lblGetAssemblyTypeId.Value));
                grid.DataSource     = null;
                grid.DataSourceID   = null;
                grid.DataSource     = ds.Tables[0];
                Session["GridData"] = ds.Tables[0];
                grid.DataBind();
            }

            cmbDay.Enabled = true;
        }
Exemple #2
0
 protected void GetMonth()
 {
     cmbMonth.DataSource = VehicleOrderRepository.Month();
     cmbMonth.TextField  = "MonthName";
     cmbMonth.ValueField = "MonthNumber";
     cmbMonth.Value      = "-Select-";
     cmbMonth.DataBind();
 }
Exemple #3
0
 protected void GetYear()
 {
     cmbYear.DataSource = VehicleOrderRepository.Year();
     cmbYear.TextField  = "Y";
     cmbYear.ValueField = "nom";
     cmbYear.Value      = "-Select-";
     cmbYear.DataBind();
 }
Exemple #4
0
        protected ControlPlanProcess UpdateItem(OrderedDictionary keys, OrderedDictionary newValues)
        {
            AppDb context = new AppDb();

            var id   = Convert.ToInt32(keys["Id"]);
            var item = context.ControlPlanProcesses.First(i => i.Id == id);

            VehicleOrderRepository.LoadNewValues(item, newValues);
            context.SaveChanges();
            return(item);
        }
Exemple #5
0
        protected void btnPrintNIK_OnClick(object sender, EventArgs e)
        {
            try
            {
                LoadData();
                //int id = Convert.ToInt32(btn.CommandArgument);
                ASPxButton btn = sender as ASPxButton;
                GridViewDataItemTemplateContainer container = btn.NamingContainer as GridViewDataItemTemplateContainer;
                var Rowindex = container.VisibleIndex;
                //int id = int.Parse(grid.GetRowValues(Rowindex, "FINNumber").ToString());
                int id = int.Parse(grid.GetRowValues(Rowindex, "Id").ToString());

                if (id != 0 || id != null)
                {
                    string query = @"UPDATE VPCStorage SET PrintNIK = GETDATE() WHERE Id=" + Convert.ToString(id);

                    AppDb   context = new AppDb();
                    DataSet dsData  = new DataSet();
                    using (SqlConnection conn = new SqlConnection(context.Database.Connection.ConnectionString))
                    {
                        if (conn.State == ConnectionState.Closed)
                        {
                            conn.Open();
                        }

                        using (SqlCommand cmd = new SqlCommand())
                        {
                            cmd.CommandText    = query;
                            cmd.CommandTimeout = 7000;
                            cmd.CommandType    = CommandType.Text;
                            cmd.Connection     = conn;
                            cmd.ExecuteNonQuery();
                        }
                    }

                    string nikNumber = VehicleOrderRepository.GetRunningNumber();
                    string user      = ((User)Session["user"]).UserName;
                    SqlDataSource1.UpdateCommand = "UPDATE VPCStorage SET PrintNIKBy ='" + user + "', NIKNumber='" + nikNumber + "' WHERE Id =" + id;
                    SqlDataSource1.Update();

                    string FinNo          = VehicleOrderRepository.GetFINNo(id);
                    string queryStringStd = "?FINNumber=" + FinNo;

                    Page.Response.Redirect("~/custom/Report/ReportNIK.aspx" + queryStringStd);
                    LoadData();
                    //Response.Redirect(Request.RawUrl);
                }
            }
            catch (Exception ex)
            {
                AppLogger.LogError(ex);
            }
        }
Exemple #6
0
        protected void btnReprint_Click(object sender, EventArgs e)
        {
            string FinNo = VehicleOrderRepository.CheckFINNo(txtReprint.Text.Trim());

            if (FinNo != null)
            {
                string queryStringStd = "?FINNumber=" + FinNo;
                Page.Response.Redirect("~/custom/Report/ReportNIKReprint.aspx" + queryStringStd);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "alertMessage", @"alert('Production No : " + txtReprint.Text.Trim() + " never print before !')", true);
            }
        }
Exemple #7
0
        protected void btnClear_Click(object sender, EventArgs e)
        {
            cmbDay.Text = "";

            if (lblGetAssemblyTypeId != null)
            {
                DataSet ds = VehicleOrderRepository.GetVPCStorageForLoadGrid(Convert.ToInt32(lblGetAssemblyTypeId.Value));

                grid.DataSource     = null;
                grid.DataSourceID   = null;
                grid.DataSource     = ds.Tables[0];
                Session["GridData"] = ds.Tables[0];
                grid.DataBind();
            }
        }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblGetAssemblyTypeId.Value = Session["assemblyType"].ToInt32(0);
            int    assemblyTypeId = Session["assemblyType"].ToInt32(0);
            string month          = DateTime.Today.Month.ToString();

            if (month.Count() == 1)
            {
                month = "0" + month;
            }

            string earlymonth = DateTime.Today.Year.ToString() + "-" + month + "-01";

            if (!IsCallback && !IsPostBack)
            {
                int start = grid.PageIndex * grid.SettingsPager.PageSize;
                int end   = (grid.PageIndex + 1) * grid.SettingsPager.PageSize;
                GridViewDataColumn column1 = grid.Columns["CategoryName"] as GridViewDataColumn;
                GridViewDataColumn column2 = grid.Columns["Description"] as GridViewDataColumn;
                for (int i = start; i < end; i++)
                {
                    ASPxTextBox txtBox1 = (ASPxTextBox)grid.FindRowCellTemplateControl(i, column1, "txtBox");
                    ASPxTextBox txtBox2 = (ASPxTextBox)grid.FindRowCellTemplateControl(i, column2, "txtBox");
                    if (txtBox1 == null || txtBox2 == null)
                    {
                        continue;
                    }
                    int id = Convert.ToInt32(grid.GetRowValues(i, grid.KeyFieldName));
                }

                GetYear();
                GetMonth();

                Session["OriSqlCommand"] = SqlDataSource1.SelectCommand;
                BindGrid(" Where A.ProdOutDate BETWEEN '" + earlymonth + "' and EOMONTH('" +
                         earlymonth + "') and A.AssemblyTypeId = " + assemblyTypeId + " and A.isCKD = 1 order by ProdOutDate asc");
            }
            else
            {
                if ((cmbDay.Text == "" || cmbDay.Text == "-Select-") && cmbYear.Text == "-Select-" && cmbMonth.Text != "-Select-" && lblGetAssemblyTypeId.Text != null) // search from month
                {
                    DataSet ds = VehicleOrderRepository.GetVPCStorageByMonth(Convert.ToInt32(cmbMonth.Value), Convert.ToInt32(lblGetAssemblyTypeId.Value));
                    grid.DataSource     = null;
                    grid.DataSourceID   = null;
                    grid.DataSource     = ds.Tables[0];
                    Session["GridData"] = ds.Tables[0];
                    grid.DataBind();
                }
                else if ((cmbDay.Text == "" || cmbDay.Text == "-Select-") && cmbYear.Text != "-Select-" && cmbMonth.Text != "-Select-" && lblGetAssemblyTypeId.Text != null) // search from month and year
                {
                    DataSet ds = VehicleOrderRepository.GetVPCStorageByMonthYear(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.Value), Convert.ToInt32(lblGetAssemblyTypeId.Value));
                    grid.DataSource     = null;
                    grid.DataSourceID   = null;
                    grid.DataSource     = ds.Tables[0];
                    Session["GridData"] = ds.Tables[0];
                    grid.DataBind();
                }
                else if ((cmbDay.Text == "" || cmbDay.Text == "-Select-") && cmbYear.Text != "-Select-" && cmbMonth.Text == "-Select-" && lblGetAssemblyTypeId.Text != null) // search from year
                {
                    DataSet ds = VehicleOrderRepository.GetVPCStorageByYear(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(lblGetAssemblyTypeId.Value));

                    grid.DataSource     = null;
                    grid.DataSourceID   = null;
                    grid.DataSource     = ds.Tables[0];
                    Session["GridData"] = ds.Tables[0];
                    grid.DataBind();
                }
                else if (!string.IsNullOrEmpty(cmbDay.Text) || cmbDay.Text != "-Select-" && lblGetAssemblyTypeId.Text != null)   // search from date
                {
                    if (cmbDay.Text == "")
                    {
                        DataSet ds = VehicleOrderRepository.GetVPCStorageForLoadGrid(Convert.ToInt32(lblGetAssemblyTypeId.Value));
                        grid.DataSource     = null;
                        grid.DataSourceID   = null;
                        grid.DataSource     = ds.Tables[0];
                        Session["GridData"] = ds.Tables[0];
                        grid.DataBind();
                    }
                    else
                    {
                        if (cmbYear.Text == "-Select-" && lblGetAssemblyTypeId.Text != null)
                        {
                            DataSet ds = VehicleOrderRepository.GetVPCStorageByDay(cmbDay.Text, Convert.ToInt32(lblGetAssemblyTypeId.Value));
                            grid.DataSource     = null;
                            grid.DataSourceID   = null;
                            grid.DataSource     = ds.Tables[0];
                            Session["GridData"] = ds.Tables[0];
                            grid.DataBind();
                        }
                        else
                        {
                            DataSet ds = VehicleOrderRepository.GetVPCStorageByDayYear(Convert.ToInt32(cmbYear.Text), cmbDay.Text, Convert.ToInt32(lblGetAssemblyTypeId.Value));
                            grid.DataSource     = null;
                            grid.DataSourceID   = null;
                            grid.DataSource     = ds.Tables[0];
                            Session["GridData"] = ds.Tables[0];
                            grid.DataBind();
                        }
                    }
                }
                else
                {
                    Session["OriSqlCommand"] = SqlDataSource1.SelectCommand;
                    BindGrid(" Where A.ProdOutDate BETWEEN '" + earlymonth + "' and EOMONTH('" +
                             earlymonth + "') and A.AssemblyTypeId = " + assemblyTypeId + " and A.isCKD = 1 order by ProdOutDate asc");
                }
            }
        }
Exemple #9
0
        private void LoadData()
        {
            if ((cmbDay.Text == "" || cmbDay.Text == "-Select-") && cmbYear.Text == "-Select-" && cmbMonth.Text != "-Select-" && lblGetAssemblyTypeId.Text != null) // search from month
            {
                DataSet ds = VehicleOrderRepository.GetVPCStorageByMonth(Convert.ToInt32(cmbMonth.Value), Convert.ToInt32(lblGetAssemblyTypeId.Value));
                grid.DataSource     = null;
                grid.DataSourceID   = null;
                grid.DataSource     = ds.Tables[0];
                Session["GridData"] = ds.Tables[0];
                grid.DataBind();
            }
            else if ((cmbDay.Text == "" || cmbDay.Text == "-Select-") && cmbYear.Text != "-Select-" && cmbMonth.Text != "-Select-" && lblGetAssemblyTypeId.Text != null) // search from month and year
            {
                DataSet ds = VehicleOrderRepository.GetVPCStorageByMonthYear(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.Value), Convert.ToInt32(lblGetAssemblyTypeId.Value));
                grid.DataSource     = null;
                grid.DataSourceID   = null;
                grid.DataSource     = ds.Tables[0];
                Session["GridData"] = ds.Tables[0];
                grid.DataBind();
            }
            else if ((cmbDay.Text == "" || cmbDay.Text == "-Select-") && cmbYear.Text != "-Select-" && cmbMonth.Text == "-Select-" && lblGetAssemblyTypeId.Text != null) // search from year
            {
                DataSet ds = VehicleOrderRepository.GetVPCStorageByYear(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(lblGetAssemblyTypeId.Value));

                grid.DataSource     = null;
                grid.DataSourceID   = null;
                grid.DataSource     = ds.Tables[0];
                Session["GridData"] = ds.Tables[0];
                grid.DataBind();
            }
            else if (!string.IsNullOrEmpty(cmbDay.Text) || cmbDay.Text != "-Select-" && lblGetAssemblyTypeId.Text != null)   // search from date
            {
                if (cmbDay.Text == "")
                {
                    DataSet ds = VehicleOrderRepository.GetVPCStorageForLoadGrid(Convert.ToInt32(lblGetAssemblyTypeId.Value));
                    grid.DataSource     = null;
                    grid.DataSourceID   = null;
                    grid.DataSource     = ds.Tables[0];
                    Session["GridData"] = ds.Tables[0];
                    grid.DataBind();
                }
                else
                {
                    if (cmbYear.Text == "-Select-" && lblGetAssemblyTypeId.Text != null)
                    {
                        DataSet ds = VehicleOrderRepository.GetVPCStorageByDay(cmbDay.Text, Convert.ToInt32(lblGetAssemblyTypeId.Value));
                        grid.DataSource     = null;
                        grid.DataSourceID   = null;
                        grid.DataSource     = ds.Tables[0];
                        Session["GridData"] = ds.Tables[0];
                        grid.DataBind();
                    }
                    else
                    {
                        DataSet ds = VehicleOrderRepository.GetVPCStorageByDayYear(Convert.ToInt32(cmbYear.Text), cmbDay.Text, Convert.ToInt32(lblGetAssemblyTypeId.Value));
                        grid.DataSource     = null;
                        grid.DataSourceID   = null;
                        grid.DataSource     = ds.Tables[0];
                        Session["GridData"] = ds.Tables[0];
                        grid.DataBind();
                    }
                }
            }
            else
            {
                grid.DataSourceID   = null;
                grid.DataSource     = SqlDataSource1;
                Session["GridData"] = SqlDataSource1;
                grid.DataBind();
            }

            if (Session["cmbMonth"] != null)
            {
                cmbMonth.Value = Session["cmbMonth"].ToString();
            }

            if (Session["cmbYear"] != null)
            {
                cmbYear.Text = Session["cmbYear"].ToString();
            }

            if (Session["cmbDay"] != null)
            {
                cmbDay.Text = Session["cmbDay"].ToString();
            }
        }
Exemple #10
0
        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            if ((cmbDay.Text == "" || cmbDay.Text == "-Select-") && cmbYear.Text == "-Select-" && cmbMonth.Text != "-Select-" && lblGetAssemblyTypeId.Text != null) // search from month
            {
                DataSet ds = VehicleOrderRepository.GetVPCStorageByMonth(Convert.ToInt32(cmbMonth.Value), Convert.ToInt32(lblGetAssemblyTypeId.Value));
                grid.DataSource     = null;
                grid.DataSourceID   = null;
                grid.DataSource     = ds.Tables[0];
                Session["GridData"] = ds.Tables[0];
                grid.DataBind();
            }
            else if ((cmbDay.Text == "" || cmbDay.Text == "-Select-") && cmbYear.Text != "-Select-" && cmbMonth.Text != "-Select-" && lblGetAssemblyTypeId.Text != null) // search from month and year
            {
                DataSet ds = VehicleOrderRepository.GetVPCStorageByMonthYear(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.Value), Convert.ToInt32(lblGetAssemblyTypeId.Value));
                grid.DataSource     = null;
                grid.DataSourceID   = null;
                grid.DataSource     = ds.Tables[0];
                Session["GridData"] = ds.Tables[0];
                grid.DataBind();
            }
            else if ((cmbDay.Text == "" || cmbDay.Text == "-Select-") && cmbYear.Text != "-Select-" && cmbMonth.Text == "-Select-" && lblGetAssemblyTypeId.Text != null) // search from year
            {
                DataSet ds = VehicleOrderRepository.GetVPCStorageByYear(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(lblGetAssemblyTypeId.Value));

                grid.DataSource     = null;
                grid.DataSourceID   = null;
                grid.DataSource     = ds.Tables[0];
                Session["GridData"] = ds.Tables[0];
                grid.DataBind();
            }
            else if (!string.IsNullOrEmpty(cmbDay.Text) || cmbDay.Text != "-Select-" && lblGetAssemblyTypeId.Text != null)   // search from date
            {
                if (cmbDay.Text == "")
                {
                    grid.DataSourceID   = null;
                    grid.DataSource     = SqlDataSource1;
                    Session["GridData"] = SqlDataSource1;
                    grid.DataBind();
                }
                else
                {
                    if (cmbYear.Text == "-Select-" && lblGetAssemblyTypeId.Text != null)
                    {
                        DataSet ds = VehicleOrderRepository.GetVPCStorageByDay(cmbDay.Text, Convert.ToInt32(lblGetAssemblyTypeId.Value));
                        grid.DataSource     = null;
                        grid.DataSourceID   = null;
                        grid.DataSource     = ds.Tables[0];
                        Session["GridData"] = ds.Tables[0];
                        grid.DataBind();
                    }
                    else
                    {
                        DataSet ds = VehicleOrderRepository.GetVPCStorageByDayYear(Convert.ToInt32(cmbYear.Text), cmbDay.Text, Convert.ToInt32(lblGetAssemblyTypeId.Value));
                        grid.DataSource     = null;
                        grid.DataSourceID   = null;
                        grid.DataSource     = ds.Tables[0];
                        Session["GridData"] = ds.Tables[0];
                        grid.DataBind();
                    }
                }
            }
            else
            {
                grid.DataSourceID   = null;
                grid.DataSource     = SqlDataSource1;
                Session["GridData"] = SqlDataSource1;
                grid.DataBind();
            }
        }