コード例 #1
0
ファイル: DBXMLDAO.cs プロジェクト: hst-bridge/BBS
        /// <summary>
        /// DBサーバーの追加
        /// </summary>
        /// <param name="dbserver"></param>
        public bool AddDBServer(DBServer dbserver)
        {
            bool status = false;

            try
            {
                DataTable dt = default(DataTable);
                DataSet   ds = new DataSet();
                ds.ReadXml(XMLPath);

                if (ds.Tables.Count > 0)
                {
                    dt = ds.Tables[0];
                }

                //判断是否已经存在
                DataColumn[] key = new DataColumn[] { dt.Columns["ServerName"], dt.Columns["DatabaseName"] };
                dt.PrimaryKey = key;
                //dt.Rows.Find(

                dt.Rows.Add(new object[] { dbserver.ServerName, dbserver.LoginName, dbserver.Password, dbserver.DatabaseName });
                ds.WriteXml(XMLPath);
                status = true;
            }
            catch (Exception ex)
            {
                status = false;
                LogManager.WriteLog(LogFile.Error, ex.Message);
            }

            return(status);
        }
コード例 #2
0
        /// <summary>
        /// 取得資料庫連線字串
        /// </summary>
        /// <param name="s"></param>
        /// <param name="t"></param>
        /// <returns></returns>
        public static string DBConnStr(DBServer s, DBType t, DBName n)
        {
            string result = "";

            result += Get_DBServer(s) + Get_DBType(t) + Get_DBName(n);
            return(result);
        }
コード例 #3
0
        public bool SetTargetInfo(DBServer dbserver)
        {
            bool status = true;

            try
            {
                string connstr = string.Format("server={0};uid={1};pwd={2};database={3};", dbserver.ServerName, dbserver.LoginName, dbserver.Password, dbserver.DatabaseName);
                ConnectionStringSettings connss = ConfigurationManager.ConnectionStrings["targetdb"];

                // 打开可执行的配置文件*.exe.config
                Configuration            config     = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                ConnectionStringSettings mySettings = new ConnectionStringSettings("targetdb", connstr, "System.Data.SqlClient");
                if (connss != null)
                {
                    config.ConnectionStrings.ConnectionStrings.Remove("targetdb");
                }
                // 将新的连接串添加到配置文件中.
                config.ConnectionStrings.ConnectionStrings.Add(mySettings);
                // 保存对配置文件所作的更改
                config.Save(ConfigurationSaveMode.Modified);
                System.Configuration.ConfigurationManager.RefreshSection("connectionStrings");
            }
            catch (Exception ex)
            {
                status = false;
                LogManager.WriteLog(LogFile.Error, ex.Message);
            }
            return(status);
        }
コード例 #4
0
        public async Task <Feedback> forgot(string tenant, string email)
        {
            Feedback feedback = new Feedback();

            try
            {
                AppNotification notification;
                notification = new AppNotification()
                {
                    type     = _userRepo.GetInstance(tenant).tableName,
                    message  = "Forgot Password Email Sending",
                    progress = 0
                };
                _notificationRepo.GetInstance(tenant).save(ref notification);
                _hubContext.Clients.All.SendAsync("SendNotification", notification);
                try
                {
                    var _userData = _userRepo.GetInstance(tenant).getByUserName(email);
                    if (_userData != null)
                    {
                        using (var transaction = DBServer.BeginTransaction())
                        {
                            _userData.otp = TokenGenerater.generateToken(7);
                            _userRepo.GetInstance(tenant).save(ref _userData, transaction);
                            //Email.Send(email, "Forgot Password", "Please reset your password:"******"Forgot password email sent sucessfully";
                            _notificationRepo.GetInstance(tenant).save(ref notification);
                            _hubContext.Clients.All.SendAsync("SendNotification", notification);
                            feedback = new Feedback
                            {
                                Code    = 1,
                                Message = "Forgot password email sent sucessfully",
                                data    = email
                            };
                        }
                    }
                }
                catch (Exception ex)
                {
                    notification.progress = -1;
                    notification.message  = "Got the error while sending reset password email";
                    _notificationRepo.GetInstance(tenant).save(ref notification);
                    _hubContext.Clients.All.SendAsync("SendNotification", notification);
                    feedback = new Feedback
                    {
                        Code    = 0,
                        Message = "Got the error while sending reset password email",
                        data    = ex
                    };
                    GitHub.createIssue(ex, new { tenant = tenant, data = email }, _accessor.HttpContext.Request.Headers);
                }
            }
            catch (Exception ex)
            {
                GitHub.createIssue(ex, new { tenant = tenant, data = email }, _accessor.HttpContext.Request.Headers);
            }
            return(feedback);
        }
コード例 #5
0
 protected void DropPart_SelectedIndexChanged(object sender, EventArgs e)
 {
     lock (thisLock)
     {
         try
         {
             DBServer db = new DBServer();
             DataSet  ds = new DataSet();
             db.PartNo = DropPart.SelectedItem.Text;
             ds        = db.ViewDescriptionbyPartNO(db);
             if (ds.Tables[0].Rows.Count > 0)
             {
                 TxtDescription.Text = ds.Tables[0].Rows[0].ItemArray[0].ToString();
                 if (DropPart.SelectedItem.Text != "-Select-" && DropType.SelectedItem.Text != "-Select-" && DropProcess.SelectedItem.Text != "-Select-")
                 {
                     get_gridresult();
                 }
                 else
                 {
                     div_user.Visible       = false;
                     DropType.SelectedValue = "0";
                     BindProcess();
                 }
             }
         }
         catch (Exception ex)
         {
             ExceptionLogging.SendExcepToDB(ex);
         }
     }
 }
コード例 #6
0
        public int AddServer(ServerModel server)
        {
            try
            {
                DBServer ns = new DBServer();
                ns.Servername = server.ServerName;
                ns.Username   = server.Username;
                ns.Password   = server.Password;
                ns.Database   = server.Database;
                ns.DBName     = server.DbAlias;
                ns.IsMain     = server.IsMain;
                ns.IsVisible  = server.IsVisible;

                using (DevKitEntities db = new DevKitEntities())
                {
                    db.DBServers.Add(ns);
                    db.SaveChanges();
                    return(ns.ServerID);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #7
0
        /// <summary>
        /// データベース先
        /// </summary>
        /// <returns></returns>
        public DBServer GetTargetInfo()
        {
            DBServer dbserver = new DBServer();

            try
            {
                string connstr = string.Empty;
                ConnectionStringSettings connss = System.Configuration.ConfigurationManager.ConnectionStrings["targetdb"];
                if (connss != null)
                {
                    connstr = connss.ConnectionString;
                    //待完善:应使用正则表达式校验格式,防止用户收到配置错误
                    string[] paras = connstr.Split(';');
                    dbserver.ServerName   = paras[0].Split('=')[1];
                    dbserver.LoginName    = paras[1].Split('=')[1];
                    dbserver.Password     = paras[2].Split('=')[1];
                    dbserver.DatabaseName = paras[3].Split('=')[1];
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogFile.Error, ex.Message);
            }
            return(dbserver);
        }
コード例 #8
0
ファイル: AccountUpdator.cs プロジェクト: 810912015/option
        void Execute()
        {
            if (al.Count == 0)
            {
                return;
            }
            List <Account> tl;

            lock (loc)
            {
                tl = al.ToList();
                al.Clear();
            }
            if (tl == null || tl.Count == 0)
            {
                return;
            }
            StringBuilder sb = new StringBuilder();

            foreach (var v in tl)
            {
                sb.AppendFormat(f, v.Sum, v.Frozen, v.Id);
            }
            using (DBServer db = new DBServer())
            {
                db.ExecNonQuery(sb.ToString());
            }
        }
コード例 #9
0
ファイル: DataOpt.cs プロジェクト: loogn/loogn
 public static int Register(Member mem)
 {
     using (var db = DBServer.GetSqlServer())
     {
         return(db.Insert("Member", new { mem.Name, mem.Password }));
     }
 }
コード例 #10
0
        public async Task <Guid> AddServer(DBServer server)
        {
            if (server.Id == Guid.Empty)
            {
                server.Id = Guid.NewGuid();
            }
            if (server is DBVMwareServer vmwareServer)
            {
                if (!string.IsNullOrWhiteSpace(vmwareServer.Password) && encrypt != null)
                {
                    vmwareServer.Password = await encrypt.Enrypt(vmwareServer.Password);
                }
                await TblVMwareServer.Insert(vmwareServer, false).IfNotExists().ExecuteAsync().ConfigureAwait(false);
            }
            else if (server is DBWindowsServer windowsServer)
            {
                if (!string.IsNullOrWhiteSpace(windowsServer.Password) && encrypt != null)
                {
                    windowsServer.Password = await encrypt.Enrypt(windowsServer.Password);
                }
                await TblWindowsServer.Insert(windowsServer, false).IfNotExists().ExecuteAsync().ConfigureAwait(false);
            }

            return(server.Id);
        }
コード例 #11
0
 private void ViewTotQTybyPartNO()
 {
     a = '0';
     if (DropPartNo.Text != "")
     {
         DBServer Db = new DBServer();
         DataSet  ds = new DataSet();
         Db.PartNo = DropPartNo.Text;
         ds        = Db.ViewTotQtybyPartnos(Db);
         if (ds.Tables[0].Rows.Count > 0)
         {
             if (ds.Tables[0].Rows[0].ItemArray[0].ToString() != "")
             {
                 a = Convert.ToDouble(ds.Tables[0].Rows[0].ItemArray[0].ToString());
                 TxtProducedQty1.Text = Convert.ToString(a);
             }
             //b =  TxtProducedQty.Text;
             //c = a + b;
             else
             {
                 a = '0';
                 TxtProducedQty1.Text = "0";
             }
         }
         else
         {
         }
     }
 }
コード例 #12
0
        private async Task <DBServer> AskForServer()
        {
            var servers = (await metaDB.GetServers()).ToArray();
            var i       = 0;

            foreach (var server in servers)
            {
                await outStream.WriteLineAsync(
                    $"{i++}: {server.Name} - {server.Type}");
            }

            DBServer chosenServer = null;

            do
            {
                await outStream.WriteAsync("Choose a number > ");

                try
                {
                    var rowId = UInt32.Parse(await inStream.ReadLineAsync());
                    chosenServer = servers[rowId];
                }
                catch
                {
                    chosenServer = null;
                }
            } while (chosenServer == null);

            return(chosenServer);
        }
コード例 #13
0
 public bool save(ref AppNotification data)
 {
     try
     {
         SqlCommand command;
         if (data == null)
         {
             throw new Exception("Null notification not allowed.");
         }
         if (String.IsNullOrEmpty(data.ntype))
         {
             data.ntype = "user";
         }
         if (data.userId == 0)
         {
         }
         data.updatedDate = DateTime.Now;
         if (data.id == 0)
         {
             data.createdDate = DateTime.Now;
             command          = data.InsertInto();
             data.id          = DBServer.ExecuteNScalar(command);
         }
         else
         {
             command = data.UpdateInto();
             DBServer.ExecuteNon(command);
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #14
0
 public async Task <bool> setThemeForUser(AppUserTheme appUserTheme)
 {
     try
     {
         SqlCommand command = new SqlCommand(String.Format(@"
              BEGIN 
              IF NOT EXISTS (SELECT USID FROM APPUSERADDONCONFIG WHERE USID=@ID)
              BEGIN
              INSERT INTO APPUSERADDONCONFIG (USID,THEME,SKIN) VALUES (@ID,@THEME,@SKIN);
              END
              ELSE
              BEGIN
              UPDATE APPUSERADDONCONFIG SET THEME=@THEME,SKIN=@SKIN WHERE USID=@ID
              END
              END
         ", tableName));
         command.Parameters.AddWithValue("@ID", appUserTheme.USID);
         command.Parameters.AddWithValue("@THEME", appUserTheme.THEME);
         command.Parameters.AddWithValue("@SKIN", appUserTheme.SKIN);
         DBServer.ExecuteNon(command);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #15
0
ファイル: Chats.cs プロジェクト: mizzouse/FreeInfantry
        static public void Handle_CS_Chat(CS_PrivateChat <Zone> pkt, Zone zone)
        {
            DBServer server = zone._server;
            Chat     chat   = server.getChat(pkt.chat);

            //WTF MATE?
            if (chat == null)
            {
                Log.write(TLog.Error, "Handle_CS_Chat(): Unable to get chat.");
                return;
            }

            SC_PrivateChat <Zone> reply = new SC_PrivateChat <Zone>();

            reply.chat    = pkt.chat;
            reply.from    = pkt.from;
            reply.message = pkt.message;
            reply.users   = chat.List();

            foreach (Zone z in server._zones)
            {
                if (z == null)
                {
                    continue;
                }

                z._client.send(reply);
            }
        }
コード例 #16
0
ファイル: DBXMLDAO.cs プロジェクト: hst-bridge/BBS
        public bool UpdateSourceDBServer(int index, DBServer dbserver)
        {
            bool status = false;

            try
            {
                DataTable dt = default(DataTable);
                DataSet   ds = new DataSet();
                ds.ReadXml(XMLPath);

                if (ds.Tables.Count > 0)
                {
                    dt = ds.Tables[0];
                }
                DataRow editRow = dt.Rows[index + 1];
                editRow["ServerName"]   = dbserver.ServerName;
                editRow["LoginName"]    = dbserver.LoginName;
                editRow["Password"]     = dbserver.Password;
                editRow["DatabaseName"] = dbserver.DatabaseName;
                dt.AcceptChanges();
                ds.WriteXml(XMLPath);
                status = true;
            }
            catch (Exception ex)
            {
                status = false;
                LogManager.WriteLog(LogFile.Error, ex.Message);
            }

            return(status);
        }
コード例 #17
0
        public ActionResult Create([Bind(Include = "DbserverID,DbserverName,DbserverVersion,DbuserName,Dbpassword,CreatedDate,ModifiedDate,DbserverSize,DbserverEnv,AppId,AppName")] DBServer dBServer)
        {
            if (ModelState.IsValid)
            {
                using (DBServerDbContext context = new DBServerDbContext())
                {
                    dBServer.CreatedDate  = DateTime.Now;
                    dBServer.ModifiedDate = DateTime.Now;
                }
                db.DBServer.Add(dBServer);
                db.SaveChanges();
                //  return RedirectToAction("Index");
                if (Session["appid"] == null || Session["env"] == null)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(RedirectToAction("Index", new { app_id = Convert.ToInt32(Session["appid"].ToString()), env = Session["env"].ToString() }));
                }
            }

            ViewBag.AppId = new SelectList(db.Applications, "AppId", "AppName", dBServer.AppId);
            return(View(dBServer));
        }
コード例 #18
0
        public ActionResult Index()
        {
            DBServer.TestConenction();
            List <Models.Car> cars = DBServer.GetCarsByName("o");

            return(View(cars));
        }
コード例 #19
0
ファイル: CExeRecHandler.cs プロジェクト: 810912015/option
 /// <summary>
 /// 更新委托状态为已行权
 /// </summary>
 /// <param name="orderIds"></param>
 public void UpdateOrderStateToExecuted(List <int> orderIds)
 {
     if (orderIds == null || orderIds.Count == 0)
     {
         return;
     }
     Task.Factory.StartNew(() =>
     {
         try
         {
             string f         = "update Orders set State =5,price =0 where Id in ({0}) ";
             StringBuilder sb = new StringBuilder();
             foreach (var v in orderIds)
             {
                 sb.AppendFormat("{0},", v);
             }
             sb.Remove(sb.Length - 1, 1);
             string s = string.Format(f, sb.ToString());
             using (DBServer db = new DBServer())
             {
                 db.ExecNonQuery(s);
             }
         }
         catch (Exception e)
         {
             Singleton <TextLog> .Instance.Error(e, "update order state for execute");
         }
     });
 }
コード例 #20
0
ファイル: FrmMain.cs プロジェクト: hst-bridge/BBS
        /// <summary>
        /// begin sync
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                #region 判断配置中的targetdb是否可用

                DBServer target = dsm.GetTargetInfo();
                if (string.IsNullOrWhiteSpace(target.ServerName) && !dsm.LinkTest(target))
                {
                    MessageBox.Show(MessageUtil.GetMessage("targetUnavailable"));
                    return;
                }

                #endregion

                /**
                 * 需要优化点:能够很好的反馈数据源的正确性
                 */

                dbsyncm.BeginSync();
                this.button1.Enabled = false;
                this.button2.Enabled = true;
            }
            catch (Exception)
            {
                MessageBox.Show(MessageUtil.GetMessage("beginFailed"));
            }
        }
コード例 #21
0
    public void loadplannedvalue()
    {
        DBServer Db        = new DBServer();
        DataSet  ds        = new DataSet();
        string   part      = Session["PartNo"].ToString();
        string   opertaion = "";

        if (Session["Operation"].ToString() == "1" || Session["Operation"].ToString() == "2")
        {
            if (Session["Operation"].ToString() == "1")
            {
                opertaion = "OP1";
            }
            if (Session["Operation"].ToString() == "2")
            {
                opertaion = "OP2";
            }
        }
        else
        {
            opertaion = Session["Operation"].ToString();
        }
        string shift = Session["Shift"].ToString();

        SqlDataAdapter da  = new SqlDataAdapter("select * from PlaneedEntryDetails where PartNo='" + part + "' and Process='" + opertaion + "' and Shift='" + shift + "'", strConnString);
        DataSet        ds1 = new DataSet();

        da.Fill(ds1);
        if (ds1.Tables[0].Rows.Count > 0)
        {
            txt_maintenance.Value = ds1.Tables[0].Rows[0]["Maintenance"].ToString();
            int tea = Convert.ToInt32(ds1.Tables[0].Rows[0]["LunchTime"].ToString()) + Convert.ToInt32(ds1.Tables[0].Rows[0]["TeaTime"].ToString());
            txt_lunch.Value          = tea.ToString();
            txt_noplan.Value         = ds1.Tables[0].Rows[0]["PlanTime"].ToString();
            txt_manuf.Value          = ds1.Tables[0].Rows[0]["Manufacturing"].ToString();
            txt_meeting.Value        = ds1.Tables[0].Rows[0]["Meeting"].ToString();
            txt_fixed.Value          = ds1.Tables[0].Rows[0]["Setup"].ToString();
            txt_shifttime.Value      = "8";// ds1.Tables[0].Rows[0]["ShiftTime"].ToString();
            txt_maintenance.Disabled = true;
            txt_lunch.Disabled       = true;
            txt_noplan.Disabled      = true;
            txt_manuf.Disabled       = true;
            txt_meeting.Disabled     = true;
            txt_fixed.Disabled       = true;
            txt_shifttime.Disabled   = true;
            //  ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "getRejection();", true);
        }
        else
        {
            txt_maintenance.Value = "";
            txt_lunch.Value       = "";
            txt_noplan.Value      = "";
            txt_manuf.Value       = "";
            txt_meeting.Value     = "";
            txt_fixed.Value       = "";
            txt_shifttime.Value   = "";
            //ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Please Enter The Bottle Neck Time In Time Master');", true);
        }
    }
コード例 #22
0
 public static async Task saveStats(ServerDB sDB)
 {
     using (var DbContext = new DBServer())
     {
         DbContext.Update(sDB);
         await DbContext.SaveChangesAsync();
     }
 }
コード例 #23
0
ファイル: DataOpt.cs プロジェクト: loogn/loogn
 public static Member Login(Member m)
 {
     using (var db = DBServer.GetSqlServer())
     {
         return(db.SelectOne <Member>("Member", "ID,Name", "Name=@n and Password=@p",
                                      db.CreateParameter("@n", m.Name), db.CreateParameter("@p", m.Password)));
     }
 }
コード例 #24
0
ファイル: DBEDIT.cs プロジェクト: hst-bridge/BBS
 private void DBEDIT_Load(object sender, EventArgs e)
 {
     dbserver           = dbsm.GetSourceInfoByIndex(this.index);
     this.textBox1.Text = dbserver.ServerName;
     this.textBox2.Text = dbserver.LoginName;
     this.textBox3.Text = dbserver.Password;
     this.textBox4.Text = dbserver.DatabaseName;
 }
コード例 #25
0
        void ExecuteSql2(string sql)
        {
            var ds = new DBServer();

            ds.ExecNonQuery(sql);
            ds.Dispose();
            ds = null;
        }
コード例 #26
0
 // free resources
 public void Dispose()
 {
     m_Attempts.Clear();
     //foreach (var key in m_Attempts.Select(x => x.Key).ToArray()) m_Attempts[key] = null;
     m_Attempts = null;
     m_SaReference.Clear();
     //foreach (var key in m_SaReference.Select(x => x.Key).ToArray()) m_SaReference[key] = null;
     m_SaReference = null;
     m_SatReference.Clear();
     //foreach (var key in m_SatReference.Select(x => x.Key).ToArray()) m_SatReference[key] = null;
     m_SatReference = null;
     m_SataReference.Clear();
     //foreach (var key in m_SataReference.Select(x => x.Key).ToArray()) m_SataReference[key] = null;
     m_SataReference = null;
     m_Auras.Clear();
     //foreach (var key in m_Auras.Select(x => x.Key).ToArray()) m_Auras[key] = null;
     m_Auras = null;
     m_Deaths.Clear();
     //foreach (var key in m_Deaths.Select(x => x.Key).ToArray()) m_Deaths[key] = null;
     m_Deaths = null;
     m_Dispels.Clear();
     //foreach (var key in m_Dispels.Select(x => x.Key).ToArray()) m_Dispels[key] = null;
     m_Dispels = null;
     m_Interrupts.Clear();
     //foreach (var key in m_Interrupts.Select(x => x.Key).ToArray()) m_Interrupts[key] = null;
     m_Interrupts = null;
     m_Damage.Clear();
     //foreach (var key in m_Damage.Select(x => x.Key).ToArray()) m_Damage[key] = null;
     m_Damage = null;
     m_Healing.Clear();
     //foreach (var key in m_Healing.Select(x => x.Key).ToArray()) m_Healing[key] = null;
     m_Healing = null;
     m_Loot.Clear();
     //foreach (var key in m_Loot.Select(x => x.Key).ToArray()) m_Loot[key] = null;
     m_Loot = null;
     m_Threat.Clear();
     //foreach (var key in m_Threat.Select(x => x.Key).ToArray()) m_Threat[key] = null;
     m_Threat = null;
     m_Casts.Clear();
     //foreach (var key in m_Casts.Select(x => x.Key).ToArray()) m_Casts[key] = null;
     m_Casts = null;
     m_Participants.Clear();
     m_Participants = null;
     foreach (var key in mAtmtCache.Select(x => x.Key).ToArray())
     {
         mAtmtCache[key] = null;
         //for (int i = 0; i < mAtmtCache[key].Length; ++i) mAtmtCache[key][i] = null;
     }
     mTooltipCache.Clear();
     mTooltipCache = null;
     mQueryCache.Clear();
     mQueryCache = null;
     mAtmtCache  = null;
     m_Instance  = null;
     m_DB        = null;
     m_Guild     = null;
     m_Server    = null;
 }
コード例 #27
0
    //public void get_Reports()
    //{
    //    ds = objserver.GetDateset("select * from EfficiencyReports");
    //    ReportDataSource rds = new ReportDataSource("DataSet1_EfficiencyReports", ds.Tables[0]);
    //    if (ds.Tables[0].Rows.Count > 0)
    //    {
    //        LocalReport lr = null;
    //        DataSet ds1 = new DataSet();
    //        ReportViewer1.ProcessingMode = ProcessingMode.Local;
    //        lr = ReportViewer1.LocalReport;
    //        lr.ReportPath = "Reports/Efficiency.rdlc";

    //        ReportViewer1.LocalReport.DataSources.Clear();
    //        ReportViewer1.LocalReport.DataSources.Add(rds);
    //        ReportViewer1.LocalReport.Refresh();

    //    }
    //    else
    //    {
    //        LocalReport lr = null;
    //        lr = ReportViewer1.LocalReport;
    //        lr.ReportPath = "Reports/Efficiency.rdlc";
    //        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Record Not Found');", true);
    //        ReportViewer1.LocalReport.DataSources.Clear();
    //        ReportViewer1.LocalReport.DataSources.Add(rds);
    //        ReportViewer1.LocalReport.Refresh();
    //    }
    //}
    //public void Showdatewise()
    //{
    //    DBServer db = new DBServer();
    //    DataSet ds = new DataSet();
    //    DateTime dt = Convert.ToDateTime(txt_from_date.Value);
    //    db.fromdate = txt_from_date.Value;
    //    db.todate = txt_to_date.Value;
    //    ds = db.ViewAllEfficiencyReportsdatetime(db);
    //    ReportDataSource rds = new ReportDataSource("DataSet1_EfficiencyReports", ds.Tables[0]);
    //    if (ds.Tables[0].Rows.Count > 0)
    //    {
    //        LocalReport lr = null;
    //        DataSet ds1 = new DataSet();
    //        ReportViewer1.ProcessingMode = ProcessingMode.Local;
    //        lr = ReportViewer1.LocalReport;
    //        lr.ReportPath = "Reports/Efficiency.rdlc";

    //        ReportViewer1.LocalReport.DataSources.Clear();
    //        ReportViewer1.LocalReport.DataSources.Add(rds);
    //        ReportViewer1.LocalReport.Refresh();
    //    }
    //    else
    //    {
    //        LocalReport lr = null;
    //        lr = ReportViewer1.LocalReport;
    //        lr.ReportPath = "Reports/Efficiency.rdlc";
    //        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Record Not Found');", true);
    //        ReportViewer1.LocalReport.DataSources.Clear();
    //        ReportViewer1.LocalReport.DataSources.Add(rds);
    //        ReportViewer1.LocalReport.Refresh();
    //    }
    //}
    ////protected void btn_datewise_Click(object sender, EventArgs e)
    ////{
    ////    Showdatewise();
    ////}
    ////protected void btn_viewall_Click(object sender, EventArgs e)
    ////{
    ////    get_Reports();
    ////}
    //protected void img_results_Click(object sender, ImageClickEventArgs e)
    //{
    //    DBServer db = new DBServer();
    //    DataSet ds = new DataSet();
    //    ds = db.ViewAllEfficiency(ddl_partno.Value.ToString(), ddl_operation.Value.ToString(), txt_from_date.Value.ToString(), txt_to_date.Value.ToString());
    //    ReportDataSource rds = new ReportDataSource("DataSet1_EfficiencyReports", ds.Tables[0]);
    //    if (ds.Tables[0].Rows.Count > 0)
    //    {
    //        LocalReport lr = null;
    //        DataSet ds1 = new DataSet();
    //        ReportViewer1.ProcessingMode = ProcessingMode.Local;
    //        lr = ReportViewer1.LocalReport;
    //        lr.ReportPath = "Reports/Efficiency.rdlc";

    //        ReportViewer1.LocalReport.DataSources.Clear();
    //        ReportViewer1.LocalReport.DataSources.Add(rds);
    //        ReportViewer1.LocalReport.Refresh();
    //    }
    //    else
    //    {
    //        LocalReport lr = null;
    //        lr = ReportViewer1.LocalReport;
    //        lr.ReportPath = "Reports/Efficiency.rdlc";
    //        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Record Not Found');", true);
    //        ReportViewer1.LocalReport.DataSources.Clear();
    //        ReportViewer1.LocalReport.DataSources.Add(rds);
    //        ReportViewer1.LocalReport.Refresh();
    //    }
    //}

    protected void img_view_Click(object sender, ImageClickEventArgs e)
    {
        string partno, operation, type, fromdate, todate, shift;

        partno    = ddl_partno.Value.ToString();
        operation = ddl_operation.Value.ToString();
        type      = ddl_type.Value.ToString();
        fromdate  = txt_fromdate.Value.ToString();
        todate    = txt_todate.Value.ToString();
        shift     = ddl_shift.Value.ToString();
        lock (thisLock)
        {
            try
            {
                if (type == "1")
                {
                    Response.Redirect("DMTRptFrm.aspx?Type=" + type + "&Partno=" + partno + "&Operation=" + operation + "&fromdate=" + fromdate + "&todate=" + todate + "&Shift=" + shift);
                }
                if (type == "2")
                {
                    DBServer db = new DBServer();
                    DataSet  ds = new DataSet();
                    ds = db.viewpageloadresulteffiency(partno, operation, fromdate, todate, shift);
                    ReportDataSource rds = new ReportDataSource("DataSet1_EfficiencyReports", ds.Tables[0]);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        LocalReport lr  = null;
                        DataSet     ds1 = new DataSet();
                        ReportViewer1.ProcessingMode = ProcessingMode.Local;
                        lr            = ReportViewer1.LocalReport;
                        lr.ReportPath = "Reports/Efficiency.rdlc";

                        ReportViewer1.LocalReport.DataSources.Clear();
                        ReportViewer1.LocalReport.DataSources.Add(rds);
                        ReportViewer1.LocalReport.Refresh();
                    }
                    else
                    {
                        LocalReport lr = null;
                        lr            = ReportViewer1.LocalReport;
                        lr.ReportPath = "Reports/Efficiency.rdlc";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Record Not Found');", true);
                        ReportViewer1.LocalReport.DataSources.Clear();
                        ReportViewer1.LocalReport.DataSources.Add(rds);
                        ReportViewer1.LocalReport.Refresh();
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLogging.SendExcepToDB(ex);
            }
            if (type == "3")
            {
                Response.Redirect("~/QualityGrid/ViewQChart.aspx?Type=" + type + "&Partno=" + partno + "&Operation=" + operation + "&fromdate=" + fromdate + "&todate=" + todate + "&Shift=" + shift);
            }
        }
    }
コード例 #28
0
ファイル: SpotModel.cs プロジェクト: 810912015/option
 public void UpdatePartial(SpotOrder so)
 {
     Task.Factory.StartNew(() =>
     {
         string sql = string.Format(f, so.Count, so.DoneCount, so.TotalDoneCount, so.DonePrice, so.TotalDoneSum, (int)so.State, so.Price, so.Id);
         using (DBServer db = new DBServer())
         {
             db.ExecNonQuery(sql);
         }
     });
 }
コード例 #29
0
    public void ProcessRequest(HttpContext context)
    {
        var dt = DBServer.GetDataTable("select * from table");
        var ms = GetExcel.DataTableToExcelXlsx(dt, "Sheet1");

        ms.WriteTo(context.Response.OutputStream);
        context.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
        context.Response.AddHeader("Content-Disposition", "attachment;filename=EasyEditCmsGridData.xlsx");
        context.Response.StatusCode = 200;
        context.Response.End();
    }
コード例 #30
0
 public IActionResult Index(Order models)
 {
     using (var db = new DBServer())
     {
         var user = int.Parse(HttpContext.Session.GetInt32("User_Login_Key").ToString());
         using (SqlCommand sqlcomm = new SqlCommand($"select * from Order where {user}"))
         {
             var list = db.Orders.ToList();
             return(View(list));
         }
     }
 }