Ejemplo n.º 1
0
 public void CreateChart24h(Chart24h chart24h)
 {
     using (SqlConnection connection = base.GetConnection())
     {
         SqlCommand command = new SqlCommand("_Chart24hUpdate", connection) {
             CommandType = CommandType.StoredProcedure
         };
         command.Parameters.AddWithValue("@Type", 0);
         command.Parameters.AddWithValue("@ChartID", 0);
         command.Parameters.AddWithValue("@ChartName", chart24h.ChartName);
         command.Parameters.AddWithValue("@Hour_1", chart24h.Hour_1);
         command.Parameters.AddWithValue("@Hour_2", chart24h.Hour_2);
         command.Parameters.AddWithValue("@Hour_3", chart24h.Hour_3);
         command.Parameters.AddWithValue("@Hour_4", chart24h.Hour_4);
         command.Parameters.AddWithValue("@Hour_5", chart24h.Hour_5);
         command.Parameters.AddWithValue("@Hour_6", chart24h.Hour_6);
         command.Parameters.AddWithValue("@Hour_7", chart24h.Hour_7);
         command.Parameters.AddWithValue("@Hour_8", chart24h.Hour_8);
         command.Parameters.AddWithValue("@Hour_9", chart24h.Hour_9);
         command.Parameters.AddWithValue("@Hour_10", chart24h.Hour_10);
         command.Parameters.AddWithValue("@Hour_11", chart24h.Hour_11);
         command.Parameters.AddWithValue("@Hour_12", chart24h.Hour_12);
         command.Parameters.AddWithValue("@Hour_13", chart24h.Hour_13);
         command.Parameters.AddWithValue("@Hour_14", chart24h.Hour_14);
         command.Parameters.AddWithValue("@Hour_15", chart24h.Hour_15);
         command.Parameters.AddWithValue("@Hour_16", chart24h.Hour_16);
         command.Parameters.AddWithValue("@Hour_17", chart24h.Hour_17);
         command.Parameters.AddWithValue("@Hour_18", chart24h.Hour_18);
         command.Parameters.AddWithValue("@Hour_19", chart24h.Hour_19);
         command.Parameters.AddWithValue("@Hour_20", chart24h.Hour_20);
         command.Parameters.AddWithValue("@Hour_21", chart24h.Hour_21);
         command.Parameters.AddWithValue("@Hour_22", chart24h.Hour_22);
         command.Parameters.AddWithValue("@Hour_23", chart24h.Hour_23);
         command.Parameters.AddWithValue("@Hour_24", chart24h.Hour_24);
         command.Parameters.AddWithValue("@ChartPostDate", chart24h.ChartPostDate);
         command.Parameters.AddWithValue("@ChartStatus", chart24h.ChartStatus);
         connection.Open();
         if (command.ExecuteNonQuery() <= 0)
         {
             throw new DataAccessException("Khong them duoc quang cao");
         }
         command.Dispose();
     }
 }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            bool _check = false;
            UploadFile(fileAttach);
            DataSet _dset = GetDataExcel(txtSheet.Text.Trim());
            if (_dset != null)
            {
                if (_dset.Tables.Count > 0)
                {

                    foreach (DataRow _dr in _dset.Tables[0].Rows)
                    {
                        #region
                        try
                        {
                            Chart24h obj = new Chart24h();

                            obj.ChartPostDate = DateTime.Now;
                            obj.ChartStatus = true;
                            if (_dr["ChartName"] != null && _dr["ChartName"] != DBNull.Value)
                            {
                                obj.ChartName = _dr["ChartName"].ToString();
                            }

                            if (_dr["F2"] != null && _dr["F2"] != DBNull.Value)
                            {
                                obj.Hour_1 = Convert.ToInt32(_dr["F2"].ToString());
                            }
                            if (_dr["F3"] != null && _dr["F3"] != DBNull.Value)
                            {
                                obj.Hour_2 = Convert.ToInt32(_dr["F3"].ToString());
                            }
                            if (_dr["F4"] != null && _dr["F4"] != DBNull.Value)
                            {
                                obj.Hour_3 = Convert.ToInt32(_dr["F4"].ToString());
                            }
                            if (_dr["F5"] != null && _dr["F5"] != DBNull.Value)
                            {
                                obj.Hour_4 = Convert.ToInt32(_dr["F5"].ToString());
                            }
                            if (_dr["F6"] != null && _dr["F6"] != DBNull.Value)
                            {
                                obj.Hour_5 = Convert.ToInt32(_dr["F6"].ToString());

                            }
                            if (_dr["F7"] != null && _dr["F7"] != DBNull.Value)
                            {
                                obj.Hour_6 = Convert.ToInt32(_dr["F7"].ToString());
                            }
                            if (_dr["F8"] != null && _dr["F8"] != DBNull.Value)
                            {
                                obj.Hour_7 = Convert.ToInt32(_dr["F8"].ToString());
                            }
                            if (_dr["F9"] != null && _dr["F9"] != DBNull.Value)
                            {
                                obj.Hour_8 = Convert.ToInt32(_dr["F9"].ToString());
                            }

                            if (_dr["F10"] != null && _dr["F10"] != DBNull.Value)
                            {
                                obj.Hour_9 = Convert.ToInt32(_dr["F10"].ToString());
                            }

                            if (_dr["F11"] != null && _dr["F11"] != DBNull.Value)
                            {
                                obj.Hour_10 = Convert.ToInt32(_dr["F11"].ToString());
                            }
                            if (_dr["F12"] != null && _dr["F12"] != DBNull.Value)
                            {
                                obj.Hour_11 = Convert.ToInt32(_dr["F12"].ToString());
                            }
                            if (_dr["F13"] != null && _dr["F13"] != DBNull.Value)
                            {
                                obj.Hour_12 = Convert.ToInt32(_dr["F13"].ToString());
                            }
                            if (_dr["F14"] != null && _dr["F14"] != DBNull.Value)
                            {
                                obj.Hour_13 = Convert.ToInt32(_dr["F14"].ToString());
                            }
                            if (_dr["F15"] != null && _dr["F15"] != DBNull.Value)
                            {
                                obj.Hour_14 = Convert.ToInt32(_dr["F15"].ToString());
                            }
                            if (_dr["F16"] != null && _dr["F16"] != DBNull.Value)
                            {
                                obj.Hour_15 = Convert.ToInt32(_dr["F16"].ToString());

                            }
                            if (_dr["F17"] != null && _dr["F17"] != DBNull.Value)
                            {
                                obj.Hour_16 = Convert.ToInt32(_dr["F17"].ToString());
                            }
                            if (_dr["F18"] != null && _dr["F18"] != DBNull.Value)
                            {
                                obj.Hour_17 = Convert.ToInt32(_dr["F18"].ToString());
                            }
                            if (_dr["F19"] != null && _dr["F19"] != DBNull.Value)
                            {
                                obj.Hour_18 = Convert.ToInt32(_dr["F19"].ToString());
                            }

                            if (_dr["F20"] != null && _dr["F20"] != DBNull.Value)
                            {
                                obj.Hour_19 = Convert.ToInt32(_dr["F20"].ToString());
                            }

                            if (_dr["F21"] != null && _dr["F21"] != DBNull.Value)
                            {
                                obj.Hour_20 = Convert.ToInt32(_dr["F21"].ToString());
                            }
                            if (_dr["F22"] != null && _dr["F22"] != DBNull.Value)
                            {
                                obj.Hour_21 = Convert.ToInt32(_dr["F22"].ToString());
                            }
                            if (_dr["F23"] != null && _dr["F23"] != DBNull.Value)
                            {
                                obj.Hour_22 = Convert.ToInt32(_dr["F23"].ToString());
                            }
                            if (_dr["F24"] != null && _dr["F24"] != DBNull.Value)
                            {
                                obj.Hour_23 = Convert.ToInt32(_dr["F24"].ToString());
                            }
                            if (_dr["F25"] != null && _dr["F25"] != DBNull.Value)
                            {
                                obj.Hour_24 = Convert.ToInt32(_dr["F25"].ToString());
                            }
                            Chart24hBSO chart24hBSO = new Chart24hBSO();
                            chart24hBSO.CreateChart24h(obj);
                            _check = true;


                            Utils objUtil = new Utils();
                            string _path = ResolveUrl("~/") + "Upload/Chart";
                            DateTime _date = obj.ChartPostDate;
                            objUtil.DeleteFile(Server.MapPath(_path), _path, _date.ToString("dd_MM_yyyy") + ".png");
                        }
                        catch { }
                        #endregion
                    }

                }
            }
            if (_check == true)
            {
                Response.Write("<script language='javascript'> {window.close(); window.opener.SubmitForm(); }</script>");
            }
        }
Ejemplo n.º 3
0
 public void CreateChart24h(Chart24h chart24h)
 {
     new Chart24hDAO().CreateChart24h(chart24h);
 }
Ejemplo n.º 4
0
 public void UpdateChart24h(Chart24h chart24h)
 {
     new Chart24hDAO().UpdateChart24h(chart24h);
 }