Ejemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="f">database file object</param>
        public TreeNodeFile(DataBase.File f, TreeViewCatalog tvc)
            : base(f.Name, f, false, false, "GenericFile", f.Size, f.Date, true, false, false, false, false)
        {
            this.file = f;

            if (f.Attributes == 1)
            {
                this.ImageIndex = TreeImages.Folder;
                this.SelectedImageIndex = TreeImages.FolderOpen;
                this.typeName = "Folder";
                this.size = -1;
            }
            else
            {
                int pos = f.Name.LastIndexOf(".");

                string ext = "";

                if (pos >= 0)
                {
                    ext = f.Name.Substring(pos);
                }

                this.ImageIndex = tvc.FileIcons.GetFileIconId(ext);
                this.SelectedImageIndex = this.ImageIndex;
                this.typeName = "File";
            }
        }
Ejemplo n.º 2
0
 /* public static Toon LoadDataBlob(byte[] p) {
     return Serializer.DeserializeWithLengthPrefix<Toon>(new MemoryStream(p), PrefixStyle.Base128);
 }*/
 internal static Toon LoadDataBlob(DataBase.AccountDBDataSet.charactersRow row)
 {
     Toon t = Serializer.DeserializeWithLengthPrefix<Toon>(new MemoryStream(row.serialized_data), PrefixStyle.Base128);
     t.Serial = row.toonid;
     t.Name = row.name;
     return t;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 添加评论确定按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void submit_Click(object sender, EventArgs e)
 {
     DataBase db = new DataBase();
     CommentEntity ce = new CommentEntity();
     ce.Agree = 0;
     ce.nid = int.Parse(Request.QueryString["nid"].ToString());
     ce.DisAgree = 0;
     ce.CommentTitle = "";
     ce.ConText = tb_comment.Text;
     ce.uid = int.Parse(Session["uid"].ToString());
     ce.UpTime = DateTime.Now;
     if (ce.ConText == "")
     {
         Response.Write("请填写评论内容!");
         return;
     }
     if (CommentOperation.AddComment(ce))
     {
         Response.Redirect("LoadComment.aspx?nid=" + ce.nid );
         return;
     }
     else
     {
         Response.Write("添加评论失败");
     }
 }
Ejemplo n.º 4
0
 public static void EditAnnouncement(int ID,String amtitle, String essay)
 {
     /*更新公告*/
     DataBase db = new DataBase();
     String sql = "UPDATE tb_announcement SET amtitle='" + amtitle + "',essay='" + essay + "' where id=" + ID.ToString();
     db.ExCommandNoBack(sql);
 }
Ejemplo n.º 5
0
                    public NickServ(ServicesDaemon Base)
                        : base(Base)
                    {
                        NickDB = new DataBase();

                        AddRequired("Help.dll");
                    }
Ejemplo n.º 6
0
 public static void EditNote(string NoteName, int ID)
 {
     /*注释的修改*/
     DataBase db = new DataBase();
     string sql = "UPDATE tb_project SET projectName ='" + NoteName + "'where id=" + ID.ToString();
     db.ExCommandNoBack(sql);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 点击修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEdit_Click(object sender, EventArgs e)
 {
     Validate();
     if (!Page.IsValid)
     {
         //如果页面验证没通过则返回
         return;
     }
     /*实例化一个数据库*/
     DataBase db1 = new DataBase();
     /*获取用户ID*/
     string ID = Session["uid"].ToString();
     string PassWord = tb_PassWord.Text;
     String str = Encrypt.encrypt(PassWord);
     string sql = "UPDATE tb_user SET  password ='******' where id=" + ID.ToString();
     try
     {
         db1.ExCommandNoBack(sql);
     }
     catch
     {
         /*修改成功,页面跳出提示*/
         SmallScript.MessageBox(Page, "修改失败!");
         return;
     }
     /*修改失败,页面跳出提示*/
     SmallScript.MessageBox(Page, "修改密码成功。");
     return;
 }
Ejemplo n.º 8
0
 public static void EditProject(string ProjectName, string description, int type,int ID)
 {
     /*工程的修改*/
     DataBase db = new DataBase();
     string sql = "UPDATE tb_project SET projectName ='" + ProjectName + "',description ='" + description + "',Tid = "+ type +" where id=" + ID.ToString();
     db.ExCommandNoBack(sql);
 }
Ejemplo n.º 9
0
 public static void DelProject(String id)
 {
     /*删除工程*/
     DataBase db = new DataBase();
     string sql = "delete from dbo.tb_project where id=" + id + "";
     db.ExCommandNoBack(sql);
 }
Ejemplo n.º 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //判断是否存在该id的工程
         int id = int.Parse(Request.QueryString["id"].ToString());
         ProjectEntity pe = ProjectOperation.GetProject(int.Parse(Request.QueryString["id"].ToString()));
         if (pe == null)
         {
             SmallScript.MessageBox(Page, "不存在该工程!点击返回!");
             SmallScript.GoBack(Page);
             return;
         }
         else
         {
             //在表单中显示数据
             DataBase db = new DataBase();
             DataSet sql = db.ExCommand(string.Format("SELECT tb_project.tid, tb_project.uid, tb_user.userName, "
             + "tb_project.description, tb_project.upTime,  "
             + "tb_project.projectName, tb_type.typeName, tb_project.id FROM tb_project INNER "
             + "JOIN tb_type ON tb_project.tid = tb_type.id INNER JOIN tb_user ON tb_project.uid = tb_user.id  WHERE (tb_project.id ={0} ) ",id));
             string User= sql.Tables[0].Rows[0][2].ToString();
             string Type = sql.Tables[0].Rows[0][0].ToString();
             tb_ProjectName.Text = pe.ProjectName;
             lb_User.Text = User;
             db_Type.SelectedIndex =int.Parse(Type);
             tb_description.Text = pe.Description;
             lb_UpTime.Text = pe.UpTime.ToString();
             lb_ID.Text = pe.Id.ToString();
         }
     }
 }
Ejemplo n.º 11
0
    /// <summary>
    /// Page_Load
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //判断是否存在该id的公告
            int id = int.Parse(Request.QueryString["id"].ToString());
            AnnouncementEntity ae = AnnouncementOperation.GetAM(int.Parse(Request.QueryString["id"].ToString()));
            if (ae == null)
            {
                SmallScript.MessageBox(Page, "不存在该公告!点击返回!");
                SmallScript.GoBack(Page);
                return;
            }
            else
            {
                //在表单中显示数据
                DataBase db = new DataBase();
                DataSet sql = db.ExCommand(string.Format("SELECT tb_announcement.id, tb_announcement.uid, tb_announcement.amtitle, tb_announcement.essay, tb_announcement.uptime, tb_user.userName FROM  tb_announcement INNER JOIN  tb_user ON tb_announcement.uid = tb_user.id  WHERE (tb_announcement.id ={0} )", id));
                string User = sql.Tables[0].Rows[0]["userName"].ToString();
                lb_ID.Text = ae.Id.ToString();
                tb_amtitle.Text = ae.AmTitle;
                lb_User.Text = User;
                lb_essay.Text = ae.Essay;
                lb_UpTime.Text =ae.Time.ToString();

            }
        }
    }
Ejemplo n.º 12
0
    public string[] createSalaryValue(string Value)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "";
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                StaffDataBase sDB = new StaffDataBase();
                List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
                Sqlconn.Open();
                string sql = "INSERT INTO PointValue (PointValue, CreateFileBy, CreateFileDate) " +
                    "VALUES(@PointValue, @CreateFileBy, (getDate()))";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@PointValue", SqlDbType.Decimal).Value = Chk.CheckStringtoDecimalFunction(Value);
                cmd.Parameters.Add("@CreateFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                returnValue[0] = cmd.ExecuteNonQuery().ToString();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message;
            }

        }
        return returnValue;
    }
Ejemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int id = int.Parse(Request.QueryString["id"].ToString());
            ProjectEntity pe = ProjectOperation.GetProject(int.Parse(Request.QueryString["id"].ToString()));

            if (pe != null)
            {
                DataBase db = new DataBase();
                DataSet sql = db.ExCommand(string.Format("SELECT tb_project.tid, tb_project.uid, tb_user.userName, "
                + "tb_project.description, tb_project.upTime,  "
                + "tb_project.projectName, tb_type.typeName, tb_project.id FROM tb_project INNER "
                + "JOIN tb_type ON tb_project.tid = tb_type.id INNER JOIN tb_user ON tb_project.uid = tb_user.id  WHERE (tb_project.id ={0} ) ", id));
                string User = sql.Tables[0].Rows[0]["userName"].ToString();
                string Type = sql.Tables[0].Rows[0]["typeName"].ToString();
                //在表单中显示数据
                lb_ProjectName.Text = pe.ProjectName;
                lb_Id.Text = pe.Id.ToString();
                lb_description.Text = pe.Description;
                lb_User.Text = User;
                lb_UpTime.Text = pe.UpTime.ToString();
                lb_Type.Text = Type;
            }
        }
    }
Ejemplo n.º 14
0
 /// <summary>
 /// 添加按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void A_Button1_Click(object sender, EventArgs e)
 {
     this.Validate();
     if (!IsValid)
     {
         return;
     }
     DataBase db = new DataBase();
     //从表单中取出数据
     string userName = tb_UserName.Text;
     string password = Encrypt.encrypt(tb_Password.Text);
     string email = tb_Email.Text;
     bool isAdmin = cb_IsAdmin.Checked;
     //新增用户的数据库操作
     if (UserOperation.Reg(userName, password, email, "", true, isAdmin, DateTime.Now))
     {
         //添加成功后显示
         SmallScript.MessageBox(Page, "添加用户成功。"+isAdmin);
         return;
     }
     else
     {
         //失败后显示信息
         SmallScript.MessageBox(Page, "添加用户失败。");
         return;
     }
 }
Ejemplo n.º 15
0
    public string[] createAidsBrandList(CreateAidsBrand structValue)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "";
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                StaffDataBase sDB = new StaffDataBase();
                List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
                Sqlconn.Open();
                string sql = "INSERT INTO AidsBrandTable (Category, Brand, CreateFileBy, CreateFileDate, UpFileBy , UpFileDate) " +
                    "VALUES(@Category, @Brand, @CreateFileBy, getDate(), @UpFileBy, getDate() )";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@Category", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(structValue.brandType);
                cmd.Parameters.Add("@Brand", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(structValue.brandName);
                cmd.Parameters.Add("@CreateFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                returnValue[0] = cmd.ExecuteNonQuery().ToString();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message;
            }

        }
        return returnValue;
    }
        public override string buildInsertQuery( String table, DataBase.TraceEntities.TraceEntityCollection fields, String[] values )
        {
            StringBuilder   stringBuilderFields = new StringBuilder();
            StringBuilder   stringBuilderValues = new StringBuilder();
            String          queryString         = "INSERT INTO {0} ({1}) values ({2})";

            // fields preparation
            if( fields != null )
            {
                foreach( TraceEntity field in fields )
                    stringBuilderFields.AppendFormat( "{0}, ", field.Field );

                stringBuilderFields.Remove( stringBuilderFields.Length - 2, 2 ); // suppression des derniers ', '
            }

            // values preparation
            if( values != null )
            {
                for( int i = 0; i < values.Length; i++ )
                {
                    if( fields.Count >= values.Length )
                    {
                        String convertedValue = getConvertedValue( values[i], fields[i].DataType, fields[i].MaxLengthNumeric );
                        stringBuilderValues.AppendFormat( "{0}, ", convertedValue );
                    }
                    else
                        stringBuilderValues.AppendFormat( "{0}, ", values[i] );
                }

                stringBuilderValues.Remove( stringBuilderValues.Length - 2, 2 ); // suppression des derniers ', '
            }

            // build the query
            return string.Format( queryString, table, stringBuilderFields.ToString(), stringBuilderValues.ToString() );
        }
    //添加考试科目事件
    protected void imgBtnSave_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            Course course = new Course();               //创建考试科目对象
            //start:胡媛媛修改,去掉考试科目输入框两边的空格,加trim(),2010-4-29
            course.Name = txtName.Text.Trim();                 //设置考试科目对象属性

            //程军添加,添加考试科目,名称不能相同。2010-4-25
            DataBase db = new DataBase();
            string mySql = "select * from Course where Name ='" + txtName.Text.Trim() + "'";
            //end:胡媛媛修改,去掉考试科目输入框两边的空格,加trim(),2010-4-29
            if (db.GetRecord(mySql))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('课程章节重复!')</script>");
                this.txtName.Focus();
            }
            else
            {
               if (course.InsertByProc())                  //调用添加考试科目方法添加考试科目
              {
                  lblMessage.Text = "成功添加该章节科目!";
              }
              else
              {
                  lblMessage.Text = "添加该章节失败!";
              }
            }

            //程军添加,添加考试科目,名称不能相同。2010-4-25
        }
    }
Ejemplo n.º 18
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        Validate();
        if (!Page.IsValid)
        {
            SmallScript.MessageBox(Page, "修改失败!"); /*修改失败,页面跳出提示*/
            /*如果页面验证没通过则返回*/
            return;
        }
        else
        {
            DataBase db1 = new DataBase(); /*实例化一个数据库*/
            string ID = Session["uid"].ToString(); /*获取用户ID*/
            /*获取用户填写信息*/
            bool Sex = (rb_Sex.SelectedIndex == 0);
            string Email = tb_Email.Text;
            string QQ = tb_QQ.Text;
            /*执行数据库更新语句*/
            /*将修改好的个人资料录入数据库*/
            string sql = "UPDATE tb_user SET  email ='" + Email + "', sex =" + (Sex ? 1 : 0).ToString() + ",  qq ='" + QQ + "' where id=" + ID.ToString();
            try
            {
                db1.ExCommandNoBack(sql);
            }
            catch
            {
                SmallScript.MessageBox(Page, "修改失败!"); /*修改失败,页面跳出提示*/
                return;
            }

            SmallScript.MessageBox(Page, "修改用户成功。"); /*修改成功,页面跳出提示*/
            return;
        }
    }
Ejemplo n.º 19
0
    protected void GridViewVillages_SelectedIndexChanging(object sender,
        GridViewSelectEventArgs e)
    {
        GridViewRow row = GridViewVillages.Rows[e.NewSelectedIndex];
        int villageId = Misc.String2Number(row.Cells[0].Text.Trim());
        PanelStats.Visible = true;
        TotalStats.Visible = true;
        string srcTable = "Goods";
        DataBase dataBase = new DataBase();
        DataSet dataSet = dataBase.GetGoods(srcTable, villageId);
        DataRow dataRow = dataSet.Tables[srcTable].Rows[0];
        string inputWood = dataRow.ItemArray[0].ToString();
        string inputClay = dataRow.ItemArray[1].ToString();
        string inputIron = dataRow.ItemArray[2].ToString();
        string inputCrop = dataRow.ItemArray[3].ToString();
        string inputVillageName = dataRow.ItemArray[4].ToString();
        LabelGoodsWood.Text = inputWood;
        LabelGoodsClay.Text = inputClay;
        LabelGoodsIron.Text = inputIron;
        LabelGoodsCrop.Text = inputCrop;
        int wood = Misc.String2Number(inputWood);
        int clay = Misc.String2Number(inputClay);
        int iron = Misc.String2Number(inputIron);
        int crop = Misc.String2Number(inputIron);
        int total = wood + clay + iron + crop;
        LabelGoodsTotal.Text = total.ToString();
        LabelVillageName.Text = inputVillageName;

        srcTable = "Reports";
        dataBase = new DataBase();
        dataSet = dataBase.GetLast5Reports(srcTable, villageId);
        RepeaterReports.DataSource = dataSet;
        RepeaterReports.DataMember = srcTable;
        RepeaterReports.DataBind();
    }
Ejemplo n.º 20
0
 protected void LinkButtonAddUser_Click(object sender, EventArgs e)
 {
     Log.Debug("Add user");
     labelManageUsersBodyInputStatus.Text = "";
     string username = textBoxManageUsersBodyInputUserName.Text.Trim();
     if (username.Length < 3)
     {
         labelManageUsersBodyInputStatus.Text = statusWrongUsername;
         Log.Warn(statusWrongUsername);
         return;
     }
     string password = textBoxManageUsersBodyInputPassword.Text.Trim();
     if (password.Length < 3)
     {
         labelManageUsersBodyInputStatus.Text = statusWrongPassword;
         Log.Warn(statusWrongPassword);
         return;
     }
     User user = new User {Name = username, Password = Misc.ConvertToSha1(password), Level = 2};
     DataBase dataBase = new DataBase();
     if (dataBase.InsertUser(user))
     {
         PopulateUsers();
         labelManageUsersBodyInputStatus.Text = "";
     }
     else
     {
         labelManageUsersBodyInputStatus.Text = statusFailedToAddUser;
         Log.Warn(statusFailedToAddUser);
     }
 }
Ejemplo n.º 21
0
    /// <summary>
    /// Page_Load
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        /*实例化一个数据库*/
        DataBase db = new DataBase();

        /* 统计现有代码数 */
        DataSet rs2 = db.ExCommand("SELECT COUNT(*) FROM tb_code");
        string intNum2 = rs2.Tables[0].Rows[0][0].ToString();
        code_num.Text = intNum2;

        /* 统计现有注释数 */
        DataSet rs3 = db.ExCommand("SELECT COUNT(*) FROM tb_note");
        string intNum3 = rs3.Tables[0].Rows[0][0].ToString();
        note_num.Text = intNum3;

        /* 统计现有评论数 */
        DataSet rs1 = db.ExCommand("SELECT COUNT(*) FROM tb_comment");
        string intNum1 = rs1.Tables[0].Rows[0][0].ToString();
        comment_num.Text = intNum1;

        /* 统计现有会员数 */
        DataSet rs = db.ExCommand("SELECT COUNT(*) FROM tb_user");
        string intNum = rs.Tables[0].Rows[0][0].ToString();
        user_num.Text = intNum;
    }
Ejemplo n.º 22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["uid"] == null)
     {
         Response.Write("请登录后再填写注释。");
         return;
     }
     DataBase db = new DataBase();
     NoteEntity ne = new NoteEntity();
     ne.Agree = 0;
     ne.Cid = int.Parse(Request.QueryString["cid"].ToString());
     ne.Disagree = 0;
     ne.EndLine = int.Parse(Request.QueryString["endline"].ToString());
     ne.NoteName = "";
     ne.StartLine = int.Parse(Request.QueryString["startline"].ToString());
     ne.Context = Request.QueryString["context"].ToString();
     ne.Uid = int.Parse(Session["uid"].ToString());
     ne.UpTime = DateTime.Now;
     if (NoteOperation.AddNote(ne))
     {
         Response.Write("注释添加成功。点击确定,关闭本窗口。");
         return;
     }
     else
     {
         Response.Write("添加注释失败");
     }
 }
Ejemplo n.º 23
0
    protected void Bind(string keyWord)
    {
        DataBase DB = new DataBase();

        Hashtable ht1 = new Hashtable();
        ht1.Add("Title", keyWord);
        ht1.Add("AnswerA", keyWord);
        ht1.Add("AnswerB", keyWord);
        ht1.Add("AnswerC", keyWord);
        ht1.Add("AnswerD", keyWord);

        DataSet ds1 = DB.AdvancedSearch("SingleProblem", ht1);

        if (ds1.Tables[0].Rows.Count > 0)//判断下是否有单选题
        {
            GridView11.DataSource = ds1;
            GridView11.DataBind();
        }

        DataSet ds2 = DB.AdvancedSearch("MultiProblem", ht1);
        if (ds2.Tables[0].Rows.Count > 0)
        {
            GridView2.DataSource = ds2;
            GridView2.DataBind();
        }

        Hashtable ht2 = new Hashtable();
        ht2.Add("Title", keyWord);
        DataSet ds3 = DB.AdvancedSearch("JudgeProblem", ht2);
        if (ds3.Tables[0].Rows.Count > 0)
        {
            GridView3.DataSource = ds3;
            GridView3.DataBind();
        }
    }
Ejemplo n.º 24
0
 public DataBase Build()
 {
     var tmp = new DataBase();
     switch (Connection.DBType)
     {
         case DataBaseType.NONE:
             break;
         case DataBaseType.MSSQL:
             tmp = new MsSqlReader(Connection).Read();
             break;
         case DataBaseType.MYSQL:
             break;
         case DataBaseType.ORICAL:
             break;
         case DataBaseType.SQLCE:
             tmp = new SqlCeReader(Connection).Read();
             break;
         case DataBaseType.ACCESS:
             break;
         case DataBaseType.SQLITE:
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
     return tmp;
 }
Ejemplo n.º 25
0
    protected void loadVideos()
    {
        DataBase db = new DataBase();
        SqlConnection conn = db.Connection();
        SqlCommand cmd = db.GetCommand(conn, "dbo.GetVideos");

        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        try
        {
            conn.Open();
            da.Fill(ds, "Videos");
        }
        catch (Exception err)
        {
            lblError.Text = err.Message;
        }
        finally
        {
            conn.Close();
            conn.Dispose();
        }

        if (ds.Tables["Videos"].Rows.Count == 0)
        {
            lblError.Text = "Нема внесено видеа во базата!";
            return;
        }

        ViewState["dsVideos"] = ds;
        gvVideos.DataSource = ds.Tables["Videos"];
        gvVideos.DataBind();
    }
Ejemplo n.º 26
0
    /// <summary>
    /// 添加顶操作
    /// </summary>
    /// <param name="de">顶的实例</param>
    /// <returns>添加成功返回true 失败返回false</returns>
    public static bool AddDing(DingEntity de)
    {
        DataBase db = new DataBase();
        try
        {
            string sql = string.Format("INSERT INTO tb_Ding (nid,uid,isDing) VALUES  ( '{0}', '{1}','{2}')", de.Nid, de.Uid, de.isDing);
            db.ExCommandNoBack(sql);
            DataSet rs = db.RunProcReturn("select * from tb_Ding where nid=" + de.Nid + "and uid=" + de.Uid, "tb_Ding");
            int ID = int.Parse(rs.Tables[0].Rows[0]["id"].ToString());
            if (rs.Tables[0].Rows.Count == 1)
            {
                return true;
            }
            else
            {
            string sql3 = "delete from dbo.tb_Ding where id=" + ID + "";
            db.ExCommandNoBack(sql3);
            return false;
            }

        }
        catch
        {
            return false;
        }
    }
Ejemplo n.º 27
0
 /// <summary>
 /// 获取顶的信息
 /// </summary>
 /// <param name="nId">注释的ID</param>
 /// <param name="uId">用户的ID </param>
 /// <param name="isDing">顶操作的类型 1为顶 0为踩</param>
 /// <returns></returns>
 public static DingEntity GetDing(int nId,int uId, int isDing)
 {
     DataBase db = new DataBase();
     DataSet rs = db.RunProcReturn("select * from tb_Ding where nid=" + nId +"and uid=" + uId, "tb_Ding");
     DataSet rs1 = db.RunProcReturn("select * from tb_note where id=" + nId , "tb_note");
     int ding = int.Parse(rs1.Tables[0].Rows[0]["agree"].ToString());
     int cai = int.Parse(rs1.Tables[0].Rows[0]["disagree"].ToString());
     int ID = int.Parse(rs.Tables[0].Rows[0]["id"].ToString());
     ding = ding + 1;
     cai = cai + 1;
     if (rs.Tables[0].Rows.Count >= 1)
     {
         if (isDing ==1 )
         {
             string sql1 = "UPDATE tb_note SET agree =" + ding + " where id="+nId;
             db.ExCommandNoBack(sql1);
         }
         else if(isDing == 0)
         {
             string sql2 = "UPDATE tb_note SET disagree =" + cai+ " where id=" + nId;
             db.ExCommandNoBack(sql2);
         }
     }
     /*else
     {
         string sql3 = "delete from dbo.tb_Ding where id=" + ID + "";
         db.ExCommandNoBack(sql3);
     }*/
     return null;
 }
Ejemplo n.º 28
0
 public AddRuleBase(Rule model, DataBase db, string bName)
 {
     _model = model;
     ButtonName = bName;
     _oldModel = (model is QuestionRule ? new QuestionRule(model as QuestionRule) : (Rule)new ResultRule(model as ResultRule)) ;
     _db = db;
 }
Ejemplo n.º 29
0
                    public FloodServ(ServicesDaemon Base)
                        : base(Base)
                    {
                        FloodDB = new DataBase();

                        AddRequired("Help.dll");
                    }
Ejemplo n.º 30
0
 public static void DelAnnouncement(String id)
 {
     /*删除公告*/
     DataBase db = new DataBase();
     string sql = "delete from dbo.tb_announcement where id=" + id + "";
     db.ExCommandNoBack(sql);
 }
Ejemplo n.º 31
0
 //查询所有用户考试的试卷
 public DataSet QueryUserPaperList()
 {
     DataBase DB = new DataBase();
     string strsql = "SELECT distinct Usersmr.UserID,Usersmr.UserName,Usersmr.DepartmentId, Departmentmr.DepartmentId,Departmentmr.DepartmentName,UserAnswermr.UserID,UserAnswermr.PaperID,UserAnswermr.ExamTime,UserAnswermr.state,Papermr.PaperName FROM Usersmr,Departmentmr,UserAnswermr,Papermr where Usersmr.DepartmentId=Departmentmr.DepartmentId and Usersmr.UserID=UserAnswermr.UserID and UserAnswermr.PaperID=Papermr.PaperID order by UserAnswermr.ExamTime desc";
     return DB.GetStrDataSet(strsql);
 }
Ejemplo n.º 32
0
 //查询所用试卷
 //不需要参数
 public DataSet QueryAllPaper()
 {
     DataBase DB = new DataBase();
     string strsql = "SELECT *,CASE Papermr.PaperState WHEN 1 THEN '可用'  ELSE  '不可用'  END AS state FROM Papermr,Coursemr where Papermr.CourseID=Coursemr.ID";
     return DB.GetStrDataSet(strsql);
 }
 public override void SetUrl(DataBase db, Table table)
 {
     Url = $"{db.Settings.RootPath}{Constants.Separator}{db.Name}{Constants.Separator}{table.Name}";
     Create();
 }
Ejemplo n.º 34
0
    public void dis()
    {
        TableCell cell1 = new TableCell();

        cell1.Text = "报修日期";
        TableCell cell2 = new TableCell();

        cell2.Text = "报修人员";
        TableCell cell3 = new TableCell();

        cell3.Text = "设备名称";
        TableCell cell4 = new TableCell();

        cell4.Text = "故障描述";
        TableCell cell5 = new TableCell();

        cell5.Text = "原因分析";
        TableCell cell6 = new TableCell();

        cell6.Text = "解决方案";
        TableCell cell7 = new TableCell();

        cell7.Text = "维修人员";
        TableCell cell8 = new TableCell();

        cell8.Text = "维修日期";
        TableCell cell9 = new TableCell();

        cell9.Text = "维修处理";
        TableRow row1 = new TableRow();

        row1.Cells.Add(cell1);
        row1.Cells.Add(cell2);
        row1.Cells.Add(cell3);
        row1.Cells.Add(cell4);
        row1.Cells.Add(cell5);
        row1.Cells.Add(cell6);
        row1.Cells.Add(cell7);
        row1.Cells.Add(cell8);
        row1.Cells.Add(cell9);
        TableCell cell10 = new TableCell();

        row1.Style.Add("background-color", "green");
        row1.Style.Add("color", "white");
        cell10.Text = "维修处理";
        Table1.Rows.Add(row1);
        SqlConnection conn = new DataBase().getSqlConnection();
        SqlCommand    cmd  = conn.CreateCommand();

        cmd.CommandText = "select * from 维修记录 order by id desc";
        try
        {
            conn.Open();
            SqlDataReader sdr = cmd.ExecuteReader();
            while (sdr.Read())
            {
                TableCell cella = new TableCell();
                cella.Width = Unit.Pixel(80);
                if (sdr[2].ToString() != "")
                {
                    cella.Text = Convert.ToDateTime(sdr[2].ToString()).ToShortDateString();
                    //报修日期
                }
                TableCell cellb = new TableCell();
                cellb.Width = Unit.Pixel(80);
                cellb.Text  = sdr[4].ToString();//报修人员
                TableCell cellc = new TableCell();
                cellc.Width = Unit.Pixel(80);
                cellc.Text  = tb[sdr[1].ToString()].ToString(); //设备名称
                TableCell celld = new TableCell();
                celld.Text = sdr[3].ToString();                 //故障描述
                TableCell celle = new TableCell();
                celle.Text = sdr[6].ToString();                 //原因分析
                TableCell cellf = new TableCell();
                cellf.Text = sdr[7].ToString();                 //解决方案
                TableCell cellg = new TableCell();
                cellg.Text  = sdr[8].ToString();                //解决人员
                cellg.Width = Unit.Pixel(80);
                TableCell cellh = new TableCell();
                cellh.Width = Unit.Pixel(80);
                if (sdr[9].ToString() != "")
                {
                    cellh.Text = Convert.ToDateTime(sdr[9].ToString()).ToShortDateString();//维修日期
                }
                TableCell cellk = new TableCell();
                cellk.Width = Unit.Pixel(80);
                //if (sdr[6].ToString() == "" || sdr[7].ToString()=="")
                {
                    LinkButton lkbtn = new LinkButton();
                    lkbtn.PostBackUrl = "/machine/shebeiweixiu.aspx?id=" + sdr[0].ToString() + "&machineName=" + cellc.Text.ToString();
                    lkbtn.Text        = "维修设备";
                    cellk.Controls.Add(lkbtn);
                }
                TableRow row = new TableRow();
                row.Cells.Add(cella);
                row.Cells.Add(cellb);
                row.Cells.Add(cellc);
                row.Cells.Add(celld);
                row.Cells.Add(celle);
                row.Cells.Add(cellf);
                row.Cells.Add(cellg);
                row.Cells.Add(cellh);
                row.Cells.Add(cellk);
                Table1.Rows.Add(row);
            }
        }
        catch (Exception ey)
        {
        }
        finally
        {
            conn.Close();
        }
    }
 /**
  * Função que apaga a relação de pontosrotulopaciente inteira de uma vez.
  */
 public static void Drop()
 {
     DataBase.Drop(tableId);
 }
 /**
  * Função que deleta dados cadastrados anteriormente na relação de pontosrotulopaciente.
  */
 public static void DeleteValue(int id)
 {
     DataBase.DeleteValue(tableId, id);
 }
Ejemplo n.º 37
0
        private DataTable tblReport()
        {
            string trial     = Request.QueryString.Get("trial");
            bool   trialFlag = false;

            string sql = "SELECT *, (select top 1 Detail from tblPendingInfo where TicketID = t1.ID order by PendingInfoOn desc) as Detail FROM tblTicket t1";

            if (Session["CompanyID"].ToString() != "7")
            {
                sql += " WHERE BranchID = " + Session["BranchID"];
                if (!string.IsNullOrEmpty(trial))
                {
                    sql      += " and CreationDate < '2020-01-01'";
                    trialFlag = true;
                }
                else
                {
                    sql += " and CreationDate >= '2020-01-01'";
                }
            }
            else if (!string.IsNullOrEmpty(trial))
            {
                sql      += " where CreationDate < '2020-01-01'";
                trialFlag = true;
            }
            else
            {
                sql += " where CreationDate >= '2020-01-01'";
            }

            sql += " ORDER BY ID DESC";

            DataTable tblTicket = DataBase.GetDT(sql);
            DataTable table     = new DataTable();

            table.Columns.Add("ID");
            table.Columns.Add("CreationDate");
            table.Columns.Add("ResponseDate");
            table.Columns.Add("TimeResponse");
            table.Columns.Add("SlaResponse");
            table.Columns.Add("RestorationDate");
            table.Columns.Add("TimeRestoration");
            table.Columns.Add("SlaRestoration");
            table.Columns.Add("TotalPendingInfoRestoration");
            table.Columns.Add("TotalAmerinodeRestoration");
            table.Columns.Add("ResolutionDate");
            table.Columns.Add("TimeResolution");
            table.Columns.Add("SlaResolution");
            table.Columns.Add("TotalPendingInfoResolution");
            table.Columns.Add("TotalAmerinodeResolution");
            table.Columns.Add("ClosureDate");
            table.Columns.Add("BranchID");
            table.Columns.Add("OEMID");
            table.Columns.Add("TechnologyID");
            table.Columns.Add("StatusID");
            table.Columns.Add("SeverityID");
            table.Columns.Add("SolutionTypeID");
            table.Columns.Add("NetworkElementID");
            table.Columns.Add("UserName");
            table.Columns.Add("ProblemTitle");
            table.Columns.Add("Advances");



            foreach (DataRow dr in tblTicket.Rows)
            {
                ClsSLA   clsSla      = new ClsSLA(Convert.ToInt32(dr["id"]), Convert.ToInt32(dr["SeverityID"]), Convert.ToInt32(dr["BranchID"]), trialFlag);
                DateTime currentTime = DateTime.Now;
                DataRow  fila        = table.NewRow();
                fila["ID"]           = dr["id"];
                fila["CreationDate"] = dr["CreationDate"];

                fila["ResponseDate"] = dr["ResponseDate"];
                if (!string.IsNullOrEmpty(dr["ResponseDate"].ToString()))
                {
                    currentTime = DateTime.Parse(dr["ResponseDate"].ToString());
                }

                ClsSlaData tResponse = clsSla.getSla(DateTime.Parse(dr["CreationDate"].ToString()), currentTime, 2);
                if (Convert.ToInt32(dr["StatusID"]) != 6)
                {
                    fila["TimeResponse"] = tResponse.timeSla;
                    if (!string.IsNullOrEmpty(dr["ResponseDate"].ToString()))
                    {
                        fila["SlaResponse"] = tResponse.inSla;
                    }
                    else
                    {
                        fila["SlaResponse"] = "PENDING";
                    }
                }
                else
                {
                    fila["TimeResponse"] = "NA";
                    fila["SlaResponse"]  = "NA";
                }

                fila["RestorationDate"] = dr["RestorationDate"];

                if (Convert.ToInt32(dr["StatusID"]) > 2 && Convert.ToInt32(dr["StatusID"]) != 6)
                {
                    currentTime = DateTime.Now;
                    if (!string.IsNullOrEmpty(dr["RestorationDate"].ToString()))
                    {
                        currentTime = DateTime.Parse(dr["RestorationDate"].ToString());
                    }
                    try
                    {
                        ClsSlaData tRestoration = clsSla.getSla(DateTime.Parse(dr["ResponseDate"].ToString()), currentTime, 3);
                        fila["TimeRestoration"] = tRestoration.timeSla;
                        if (!string.IsNullOrEmpty(dr["RestorationDate"].ToString()))
                        {
                            fila["SlaRestoration"] = tRestoration.inSla;
                        }
                        else
                        {
                            fila["SlaRestoration"] = "PENDING";
                        }

                        fila["TotalPendingInfoRestoration"] = tRestoration.slaFromPendingInfo;
                        fila["TotalAmerinodeRestoration"]   = tRestoration.timeSla;
                    }
                    catch (Exception)
                    {
                        fila["TimeRestoration"]             = "";
                        fila["SlaRestoration"]              = "PENDING";
                        fila["TotalPendingInfoRestoration"] = "";
                        fila["TotalAmerinodeRestoration"]   = "";
                    }
                }
                else if (Convert.ToInt32(dr["StatusID"]) == 6)
                {
                    fila["TimeRestoration"]             = "NA";
                    fila["SlaRestoration"]              = "NA";
                    fila["TotalPendingInfoRestoration"] = "NA";
                    fila["TotalAmerinodeRestoration"]   = "NA";
                }
                else
                {
                    fila["TimeRestoration"]             = "";
                    fila["SlaRestoration"]              = "PENDING";
                    fila["TotalPendingInfoRestoration"] = "";
                    fila["TotalAmerinodeRestoration"]   = "";
                }

                if (Convert.ToInt32(dr["StatusID"]) > 3 && Convert.ToInt32(dr["StatusID"]) != 6)
                {
                    currentTime = DateTime.Now;
                    if (!string.IsNullOrEmpty(dr["ResolutionDate"].ToString()))
                    {
                        currentTime = DateTime.Parse(dr["ResolutionDate"].ToString());
                    }
                    try
                    {
                        ClsSlaData tResolution = clsSla.getSla(DateTime.Parse(dr["RestorationDate"].ToString()), currentTime, 4);
                        fila["TimeResolution"] = tResolution.timeSla;
                        if (!string.IsNullOrEmpty(dr["ResolutionDate"].ToString()))
                        {
                            fila["SlaResolution"] = tResolution.inSla;
                        }
                        else
                        {
                            fila["SlaResolution"] = "PENDING";
                        }

                        fila["TotalPendingInfoResolution"] = tResolution.slaFromPendingInfo;
                        fila["TotalAmerinodeResolution"]   = tResolution.timeSla;
                    }
                    catch (Exception)
                    {
                        fila["TimeResolution"]             = "";
                        fila["SlaResolution"]              = "PENDING";
                        fila["TotalPendingInfoResolution"] = "";
                        fila["TotalAmerinodeResolution"]   = "";
                    }
                }
                else if (Convert.ToInt32(dr["StatusID"]) == 6)
                {
                    fila["TimeResolution"]             = "NA";
                    fila["SlaResolution"]              = "NA";
                    fila["TotalPendingInfoResolution"] = "";
                    fila["TotalAmerinodeResolution"]   = "";
                }
                else
                {
                    fila["TimeResolution"]             = "";
                    fila["SlaResolution"]              = "PENDING";
                    fila["TotalPendingInfoResolution"] = "";
                    fila["TotalAmerinodeResolution"]   = "";
                }

                fila["ResolutionDate"]   = dr["ResolutionDate"];
                fila["ClosureDate"]      = dr["ClosureDate"];
                fila["BranchID"]         = dr["BranchID"];
                fila["OEMID"]            = dr["OEMID"];
                fila["TechnologyID"]     = dr["TechnologyID"];
                fila["StatusID"]         = dr["StatusID"];
                fila["SeverityID"]       = dr["SeverityID"];
                fila["SolutionTypeID"]   = dr["SolutionTypeID"];
                fila["NetworkElementID"] = dr["NetworkElementID"];
                fila["UserName"]         = dr["UserName"];
                fila["ProblemTitle"]     = dr["ProblemTitle"];
                if (Convert.ToInt32(dr["StatusID"]) == 5)
                {
                    string note         = dr["ClosureNote"].ToString();
                    int    indexInitial = note.IndexOf("Date:");
                    int    indexFinish  = note.IndexOf("\n-");
                    if (indexInitial >= 0 && indexFinish >= 0)
                    {
                        string texto = note.Substring(indexInitial, indexFinish - 1);
                        indexInitial     = texto.IndexOf("\n");
                        texto            = texto.Substring(indexInitial);
                        fila["Advances"] = texto;
                    }
                    else
                    {
                        fila["Advances"] = note;
                    }
                }
                else
                {
                    fila["Advances"] = dr["Detail"];
                }

                table.Rows.Add(fila);
            }

            return(table);
        }
Ejemplo n.º 38
0
        /// <summary>
        /// 分类视频并导入
        /// </summary>
        /// <param name="MoviePaths"></param>
        /// <param name="ct"></param>
        /// <param name="IsEurope"></param>
        /// <returns></returns>
        public static double DistinctMovieAndInsert(List <string> MoviePaths, CancellationToken ct, bool IsEurope = false)
        {
            Logger.LogScanInfo(Environment.NewLine + "-----【" + DateTime.Now.ToString() + "】-----");
            Logger.LogScanInfo(Environment.NewLine + $"{Jvedio.Language.Resources.ScanVideo} => {MoviePaths.Count} " + Environment.NewLine);

            List <string> result1        = new List <string>();
            string        log1           = "";
            string        id             = "";
            VedioType     vt             = 0;
            double        totalinsertnum = 0; //总的导入数目
            double        unidentifynum  = 0; //无法识别的数目

            //检查未识别出番号的视频
            foreach (var item in MoviePaths)
            {
                if (File.Exists(item))
                {
                    id = IsEurope ? Identify.GetEuFanhao(new FileInfo(item).Name) : Identify.GetFanhao(new FileInfo(item).Name);

                    if (IsEurope)
                    {
                        if (string.IsNullOrEmpty(id))
                        {
                            vt = 0;
                        }
                        else
                        {
                            vt = VedioType.欧美;
                        }
                    }
                    else
                    {
                        vt = Identify.GetVedioType(id);
                    }


                    if (vt != 0)
                    {
                        result1.Add(item);
                    }
                    else
                    {
                        log1 += "   " + item + Environment.NewLine;
                        unidentifynum++;
                    }
                }
            }
            Logger.LogScanInfo(Environment.NewLine + $"【{Jvedio.Language.Resources.NotRecognizeNumber} :{unidentifynum}】" + Environment.NewLine + log1);

            //检查 重复|分段 视频
            Dictionary <string, List <string> > repeatlist = new Dictionary <string, List <string> >();
            string log2 = "";

            foreach (var item in result1)
            {
                if (File.Exists(item))
                {
                    id = IsEurope ? Identify.GetEuFanhao(new FileInfo(item).Name) : Identify.GetFanhao(new FileInfo(item).Name);
                    if (!repeatlist.ContainsKey(id))
                    {
                        List <string> pathlist = new List <string> {
                            item
                        };
                        repeatlist.Add(id, pathlist);
                    }
                    else
                    {
                        repeatlist[id].Add(item);//每个 id 对应一组视频路径,视频路径最多的视为分段视频
                    }
                }
            }

            List <string>         removelist     = new List <string>();
            List <List <string> > subsectionlist = new List <List <string> >();

            foreach (KeyValuePair <string, List <string> > kvp in repeatlist)
            {
                if (kvp.Value.Count > 1)
                {
                    //路径个数大于1 才为分段视频
                    (bool issubsection, List <string> filepathlist, List <string> notsubsection) = IsSubSection(kvp.Value);
                    if (issubsection)
                    {
                        subsectionlist.Add(filepathlist);
                        if (filepathlist.Count < kvp.Value.Count)
                        {
                            //其中几个不是分段视频
                            log2 += $"   {Jvedio.Language.Resources.ID} :{kvp.Key}" + Environment.NewLine;
                            removelist.AddRange(notsubsection);
                            log2 += $"      {Jvedio.Language.Resources.ImportSubSection}: {filepathlist.Count} ,:{string.Join(";", filepathlist)}" + Environment.NewLine;
                            notsubsection.ForEach(arg =>
                            {
                                log2 += $"      {Jvedio.Language.Resources.NotImport} :{arg}" + Environment.NewLine;
                            });
                        }
                    }
                    else
                    {
                        log2 += $"   {Jvedio.Language.Resources.ID}:{kvp.Key}" + Environment.NewLine;
                        (string maxfilepath, List <string> Excludelsist) = ExcludeMaximumSize(kvp.Value);
                        removelist.AddRange(Excludelsist);
                        log2 += $"      {Jvedio.Language.Resources.ImportFile} :{maxfilepath},{Jvedio.Language.Resources.FileSize} :{new FileInfo(maxfilepath).Length}" + Environment.NewLine;
                        Excludelsist.ForEach(arg =>
                        {
                            log2 += $"      {Jvedio.Language.Resources.NotImport} :{arg},{Jvedio.Language.Resources.FileSize} :{new FileInfo(arg).Length}" + Environment.NewLine;
                        });
                    }
                }
            }
            Logger.LogScanInfo(Environment.NewLine + $"【 {Jvedio.Language.Resources.RepeatVideo}:{removelist.Count + subsectionlist.Count}】" + Environment.NewLine + log2);

            List <string> insertList = result1.Except(removelist).ToList();//需要导入的视频

            //导入分段视频
            foreach (var item in subsectionlist)
            {
                insertList = insertList.Except(item).ToList();
                ct.ThrowIfCancellationRequested();
                string   subsection = "";
                FileInfo fileinfo   = new FileInfo(item[0]);//获得第一个视频的文件信息
                id = IsEurope ? Identify.GetEuFanhao(fileinfo.Name) : Identify.GetFanhao(fileinfo.Name);
                if (IsEurope)
                {
                    if (string.IsNullOrEmpty(id))
                    {
                        continue;
                    }
                    else
                    {
                        vt = VedioType.欧美;
                    }
                }
                else
                {
                    vt = Identify.GetVedioType(id);
                }
                if (string.IsNullOrEmpty(id) | vt == 0)
                {
                    continue;
                }

                //文件大小视为所有文件之和
                double filesize = 0;
                for (int i = 0; i < item.Count; i++)
                {
                    if (!File.Exists(item[i]))
                    {
                        continue;
                    }
                    FileInfo fi = new FileInfo(item[i]);
                    subsection += item[i] + ";";
                    filesize   += fi.Length;
                }

                //获取创建日期
                string createDate = "";
                try { createDate = fileinfo.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); }
                catch { }
                if (createDate == "")
                {
                    createDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                }

                Movie movie = new Movie()
                {
                    filepath   = item[0],
                    id         = id,
                    filesize   = filesize,
                    vediotype  = (int)vt,
                    subsection = subsection.Substring(0, subsection.Length - 1),
                    otherinfo  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    scandate   = createDate
                };

                DataBase.InsertScanMovie(movie);
                totalinsertnum += 1;
            }

            //导入剩余的所有视频
            foreach (var item in insertList)
            {
                ct.ThrowIfCancellationRequested();
                if (!File.Exists(item))
                {
                    continue;
                }
                FileInfo fileinfo = new FileInfo(item);

                string createDate = "";
                try { createDate = fileinfo.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); }
                catch { }
                if (createDate == "")
                {
                    createDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                }

                id = IsEurope ? Identify.GetEuFanhao(fileinfo.Name) : Identify.GetFanhao(fileinfo.Name);
                if (IsEurope)
                {
                    if (string.IsNullOrEmpty(id))
                    {
                        continue;
                    }
                    else
                    {
                        vt = VedioType.欧美;
                    }
                }
                else
                {
                    vt = Identify.GetVedioType(id);
                }
                Movie movie = new Movie()
                {
                    filepath  = item,
                    id        = id,
                    filesize  = fileinfo.Length,
                    vediotype = (int)vt,
                    otherinfo = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    scandate  = createDate
                };
                DataBase.InsertScanMovie(movie);
                totalinsertnum += 1;
            }

            Logger.LogScanInfo(Environment.NewLine + $"{Jvedio.Language.Resources.TotalImport} => {totalinsertnum},{Jvedio.Language.Resources.ImportAttention}" + Environment.NewLine);


            //从 主数据库中 复制信息
            //if (Path.GetFileNameWithoutExtension(Properties.Settings.Default.DataBasePath).ToLower() != "info")
            //{
            //    try
            //    {
            //        string src = AppDomain.CurrentDomain.BaseDirectory + "DataBase\\info.sqlite";
            //        string dst = AppDomain.CurrentDomain.BaseDirectory + $"DataBase\\{Path.GetFileNameWithoutExtension(Properties.Settings.Default.DataBasePath).ToLower()}.sqlite"; ;
            //        DataBase.CopyDatabaseInfo(src, dst);
            //    }
            //    catch { }
            //}
            return(totalinsertnum);
        }
Ejemplo n.º 39
0
        public static double InsertWithNfo(List <string> filepaths, CancellationToken ct, Action <string> messageCallBack = null, bool IsEurope = false)
        {
            List <string> nfopaths   = new List <string>();
            List <string> vediopaths = new List <string>();

            foreach (var item in filepaths)
            {
                if (item.ToLower().EndsWith(".nfo"))
                {
                    nfopaths.Add(item);
                }
                else
                {
                    vediopaths.Add(item);
                }
            }

            //先导入 nfo 再导入视频,避免路径覆盖
            if (nfopaths.Count > 0 && Properties.Settings.Default.ScanNfo)
            {
                Logger.LogScanInfo(Environment.NewLine + "-----【" + DateTime.Now.ToString() + "】-----");
                Logger.LogScanInfo(Environment.NewLine + $"{Jvedio.Language.Resources.ScanNFO} => {nfopaths.Count}  " + Environment.NewLine);

                double total = 0;
                //导入 nfo 文件
                nfopaths.ForEach(item =>
                {
                    if (File.Exists(item))
                    {
                        Movie movie = FileProcess.GetInfoFromNfo(item);
                        if (movie != null && !string.IsNullOrEmpty(movie.id))
                        {
                            DataBase.InsertFullMovie(movie);
                            total += 1;
                            Logger.LogScanInfo(Environment.NewLine + $"{Jvedio.Language.Resources.SuccessImportToDataBase} => {item}  ");
                        }
                    }
                });


                Logger.LogScanInfo(Environment.NewLine + $"{Jvedio.Language.Resources.ImportNFONumber}: {total}" + Environment.NewLine);
                messageCallBack?.Invoke($"{Jvedio.Language.Resources.ImportNFONumber}: {total}");
            }


            //导入视频
            if (vediopaths.Count > 0)
            {
                try
                {
                    double _num = Scan.DistinctMovieAndInsert(vediopaths, ct, IsEurope);
                    messageCallBack?.Invoke($"{Jvedio.Language.Resources.ImportVideioNumber}:{_num},详情请看日志");
                    return(_num);
                }catch (OperationCanceledException ex)
                {
                    Logger.LogF(ex);
                    messageCallBack?.Invoke($"{Jvedio.Language.Resources.Cancel}");
                }
            }
            return(0);
        }
Ejemplo n.º 40
0
 public DataTable Consultar(int id_grv)
 {
     return(DataBase.Select("SELECT TOP 1\r\n                 tb_dep_Grv.id_grv\r\n                , tb_dep_Grv.id_status_operacao\r\n                , tb_dep_grv.id_cliente\r\n                , tb_dep_Grv.numero_formulario_grv\r\n                , db_global..tb_glo_emp_empresas.nome\r\n                , db_global..tb_glo_emp_empresas.inscricao_municipal\r\n                , db_global..tb_glo_emp_empresas.cnpj\r\n                , tb_dep_clientes.nome\r\n                , tb_glo_loc_municipios.codigo_municipio_ibge\r\n                , tb_dep_atendimento.nota_fiscal_nome\r\n                , tb_dep_atendimento.nota_fiscal_cpf\r\n                , tb_dep_atendimento.nota_fiscal_endereco\r\n                , tb_dep_atendimento.nota_fiscal_numero\r\n                , tb_dep_atendimento.nota_fiscal_complemento\r\n                , tb_dep_atendimento.nota_fiscal_bairro\r\n                , tb_dep_atendimento.nota_fiscal_municipio\r\n                , tb_dep_atendimento.nota_fiscal_uf\r\n                , tb_dep_atendimento.nota_fiscal_cep\r\n                , tb_dep_atendimento.nota_fiscal_ddd\r\n                , tb_dep_atendimento.nota_fiscal_telefone\r\n                , tb_dep_atendimento.nota_fiscal_email\r\n                , tb_dep_faturamento.id_faturamento\r\n                , tb_dep_faturamento.data_pagamento\r\n                , tb_dep_faturamento.valor_pagamento\r\n                FROM tb_dep_grv\r\n                JOIN tb_dep_clientes ON tb_dep_grv.id_cliente = tb_dep_clientes.id_cliente\r\n                JOIN  db_global..tb_glo_emp_empresas ON db_global..tb_glo_emp_empresas.id_empresa = tb_dep_clientes.id_empresa \r\n                JOIN  db_global..tb_glo_loc_cep ON db_global..tb_glo_loc_cep.id_cep = tb_dep_clientes.id_cep\r\n                JOIN  db_global..tb_glo_loc_municipios ON db_global..tb_glo_loc_municipios.id_municipio = db_global..tb_glo_loc_cep.id_municipio\r\n                JOIN tb_dep_atendimento ON tb_dep_atendimento.id_grv = tb_dep_grv.id_grv\r\n                JOIN tb_dep_faturamento ON tb_dep_faturamento.id_atendimento = tb_dep_atendimento.id_atendimento\r\n                WHERE tb_dep_Grv.id_grv IN (" + id_grv + ")\r\n                AND   tb_dep_Grv.id_status_operacao = 'E'"));
 }
Ejemplo n.º 41
0
        public IActionResult List()
        {
            List <Product> products = DataBase.GetProducts();

            return(View(products));
        }
Ejemplo n.º 42
0
 public AngajatRepository(DataBase context) : base(context)
 {
 }
Ejemplo n.º 43
0
 public TransactionManager(DataBase context)
 {
     Context = context;
 }
Ejemplo n.º 44
0
        public IActionResult Detail(string slugLink)
        {
            Product product = DataBase.GetProduct(slugLink);

            return(View(product));
        }
 /***********************************************
          Returns an EmployeeVO object given a valid employeeid
       *************************************************/
 public EmployeeVO GetEmployee(Guid employeeid){
   DbCommand command = DataBase.GetSqlStringCommand(SELECT_EMPLOYEE_BY_EMPLOYEE_ID);
   DataBase.AddInParameter(command, EMPLOYEE_ID, DbType.Guid, employeeid);
   return this.GetEmployee(command);
 }
Ejemplo n.º 46
0
 private void CriarBancoDados()
 {
     db = new DataBase();
     db.CriarBancoDeDados();
 }
Ejemplo n.º 47
0
 public TableTemplateDomain(Authentication authentication, CremaTemplate templateSource, DataBase dataBase, string itemPath, string itemType)
     : base(authentication.ID, dataBase.ID, itemPath, itemType)
 {
     this.template = templateSource;
     this.view     = this.template.View;
 }
 /************************************
           Returns a List<EmployeeVO> object
       **************************************/
 public List<EmployeeVO> GetAllEmployees(){
   DbCommand command = DataBase.GetSqlStringCommand(SELECT_ALL_EMPLOYEES);
   return this.GetEmployeeList(command);
 }
Ejemplo n.º 49
0
 public CreateModel(DataBase dataBase)
 {
     _dataBase = dataBase;
 }
Ejemplo n.º 50
0
        static void Main(string[] args)
        {
            XmlConfigurator.Configure();
            log.Info("Starting program");

            //Loading configuration from file
            try
            {
                config = new ConfLoader().loadConfFromFile("LMAX_sender_config.txt");
            }
            catch (Exception e)
            {
                log.Error(e.Message);
                log.Debug(e.StackTrace.ToString());
                log.Error("Exit program");
                return;
            }
            random = new Random((int)DateTime.Now.Ticks / 10000);
            isQuit = isRefrash = false;
            Thread t = new Thread(new ThreadStart(KeyReadHandler));

            t.Name = "Key handler thread";
            t.Start();

            syncUsers = new List <string>();
            NewUsers  = new List <string>();

            //Create lock objects
            usersLock      = new Object();
            errorWriteLock = new Object();
            mustSyncLock   = new Object();
            randomLock     = new Object();
            newUserLock    = new Object();

            //Create necessary datas
            BlockingCollection <Operations> blokingQueue = new BlockingCollection <Operations>();

            //create sender db handler
            dbHandler = new ErrorDbHandler();

            //create object for manipulat with local DB
            localDbHandler = new LocalDbHandler();

            //Create error handler class for error solutions
            ErrorHandler errorHandler = new ErrorHandler("ytsnotify", "YTS_admin password");

            // Get datas from DB about users
            remoteDbHandler = new DataBase();

            try
            {
                lock (usersLock)
                {
                    idUsers = remoteDbHandler.getConnectedUsers(dbHandler, errorHandler);

                    /*
                     * idUsers = new Dictionary<int, List<TradingClass>>();
                     * List<TradingClass> list1 = new List<TradingClass>();
                     * List<TradingClass> list2 = new List<TradingClass>();
                     *
                     * for (int i = 0; i < 2; ++i)
                     * {
                     *  list.Add(new TradingClass("user_"+i,"userName_"+i,"Passwd_0"+i,"URL","userEmail",dbHandler));
                     *  list[i].Login();
                     *  Console.WriteLine("\tConnected users {0}", i);
                     * }
                     *
                     * list1.Add(new TradingClass("user_1", "userName_1", "Passwd_1", "URL", "userEmail", dbHandler));
                     * list2.Add(new TradingClass("user_2", "userName_2", "Passwd_2", "URL", "userEmail", dbHandler));
                     * list1[0].Login();
                     * list2[0].Login();
                     * idUsers.Add(10001, list1);
                     * idUsers.Add(10002, list2);*/
                }
            }
            catch (Exception e)
            {
                log.Error(e.Message);
                log.Debug(e.StackTrace.ToString());
                log.Error("Exit program");
                log.Info("Exit program becouse of error");
                return;
            }
            System.Console.WriteLine("Get {0} users from DB", idUsers.Values.Count);

            //Create class for user control directly after create users
            externalClientManager = new ExternalClientManager();

            //Create listen port
            Type serviceType = typeof(ExternalClientManager);
            Uri  serviceUri  = new Uri("http://localhost:9081/");

            System.ServiceModel.ServiceHost host = new System.ServiceModel.ServiceHost(serviceType, serviceUri);
            host.Open();

            // Start NETlistener to get new users from DB
            //NETlistener netListener = new NETlistener();

            DateTime time0 = new DateTime();
            DateTime oTime = new DateTime();

            //Create time reader from file
            DateFileWritter dateFile = new DateFileWritter();

            time0 = dateFile.ReadTime();

            //Create systemContainer to cach DB lastest data
            systemContainer = new SystemContainer(blokingQueue, time0);

            //Create sender class
            SenderClass sender = new SenderClass(blokingQueue);

            List <DBResult> res = new List <DBResult>();

            Console.WriteLine("Loaded time value : {0}", time0.ToString("yyyy-MM-dd HH:mm:ss.fff"));

            long start;
            long finish;
            long waitTime;

            while (true)
            {
                if (isQuit)
                {
                    Console.WriteLine("Buy....");
                    return;
                }
                //Створити нових фоловерів якщо вони є в списку
                //CreateFromMarketFollowers(time0);
                //Вирішити проблеми синхронізації
                ProcessUsersSolveProblem(time0);

                start = DateTime.Now.Ticks / 10000;

                res = (List <DBResult>)remoteDbHandler.GetDBResult(time0);

                if (res != null && res.Count > 0)
                {
                    System.Console.WriteLine("Get results : {0}", res.Count);
                    oTime = time0;
                    time0 = res[0].DbTime;
                    dateFile.WriteTime(time0);

                    foreach (DBResult item in res)
                    {
                        systemContainer.AddElement(item);
                    }
                    systemContainer.processSystems(idUsers, oTime);
                }

                finish   = DateTime.Now.Ticks / 10000;
                waitTime = MUST_WAIT - (finish - start);

                if (waitTime > 0)
                {
                    Thread.Sleep((int)waitTime);
                }
                Console.WriteLine("wait in main loop");
            }
            //netListener.ShutDown();
            sender.ShutDown();
        }
Ejemplo n.º 51
0
 public AlbumViewModel(DataBase db)
 {
     ArtistList = db.Artist.Select(a => new SelectViewModel {
         Id = a.Id, Name = a.Name
     }).ToList();
 }
        private void btnInqury_Click(object sender, EventArgs e)
        {
            //清除listView中的数据
            listView.Items.Clear();

            //获取用户输入的值
            String search = textSearch.Text.Trim();

            //判断用户输入值是否为全空
            if (string.IsNullOrEmpty(search))
            {
                MessageBox.Show("查询项不能为空", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //连接数据库
            SqlConnection conn = DataBase.Connect();

            try
            {
                //创建一个SqlDataReader对象
                SqlDataReader dr = null;

                //按用户ID查询
                if (radioButtonUserID.Checked == true)
                {
                    //创建SQL查询语句,此证书编号是否存在
                    String strCmd = "select * from 用户重要操作历史表 where 操作用户ID = '" + search + "' order by 操作日期 DESC";

                    //判断操作用户ID是否存在
                    if (!DataBase.Inquire(strCmd, conn))
                    {
                        MessageBox.Show("操作用户ID输入错误或不存在", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    //执行查询操作
                    DataBase.Inquire(strCmd, conn, ref dr);

                    //清除listView中的数据
                    listView.Items.Clear();

                    //输出结果
                    while (dr.Read())
                    {
                        //实例化一个ListViewItem对象
                        ListViewItem lv = new ListViewItem();

                        lv.Text = dr["操作用户ID"].ToString().Trim();//设置第一行显示的数据
                        //绑定剩余列的数据
                        lv.SubItems.Add(dr["操作日期"].ToString().Trim());
                        lv.SubItems.Add(dr["操作名称"].ToString().Trim());

                        //行数据创建完毕后添加到列表中
                        listView.Items.Add(lv);
                    }

                    if (!dr.IsClosed)
                    {
                        dr.Close();
                    }
                }
                else if (radioButtonDate.Checked == true)
                {
                    //时间数据类型转换
                    DateTime dt = new DateTime();
                    try
                    {
                        dt = DateTime.ParseExact(search, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture);
                    }
                    catch (Exception et)
                    {
                        MessageBox.Show(et.Message + ",输入的日期格式不正确", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    //创建SQL查询语句,用于按日期查询用户操作记录
                    String strCmd = "select * from 用户重要操作历史表 where 操作日期 >= '" + dt.ToString() + "' and 操作日期 < '" + dt.AddDays(1).ToString() + "' order by 操作日期 DESC";

                    //执行查询操作
                    DataBase.Inquire(strCmd, conn, ref dr);

                    //清除listView中的数据
                    listView.Items.Clear();

                    //输出结果
                    while (dr.Read())
                    {
                        //实例化一个ListViewItem对象
                        ListViewItem lv = new ListViewItem();

                        lv.Text = dr["操作用户ID"].ToString().Trim();//设置第一行显示的数据
                        //绑定剩余列的数据
                        lv.SubItems.Add(dr["操作日期"].ToString().Trim());
                        lv.SubItems.Add(dr["操作名称"].ToString().Trim());

                        //行数据创建完毕后添加到列表中
                        listView.Items.Add(lv);
                    }

                    if (!dr.IsClosed)
                    {
                        dr.Close();
                    }
                }
                else
                {
                    MessageBox.Show("只能填写其中一项进行查询", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                DataBase.Close(conn);
            }
        }
Ejemplo n.º 53
0
        protected void btOpen_Click(object sender, EventArgs e)
        {
            //Update the contact info on the user
            string sql             = "UPDATE aspnet_Users SET WorkPhone = @work, MobilePhone = @mobile, HasWhatsapp = @whats WHERE UserName = @UserName";
            List <SqlParameter> sp = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@work", SqlDbType = SqlDbType.NVarChar, Value = tbWork.Text
                },
                new SqlParameter()
                {
                    ParameterName = "@mobile", SqlDbType = SqlDbType.NVarChar, Value = tbMobile.Text
                },
                new SqlParameter()
                {
                    ParameterName = "@whats", SqlDbType = SqlDbType.Bit, Value = chWhats.Checked
                },
                new SqlParameter()
                {
                    ParameterName = "@UserName", SqlDbType = SqlDbType.NVarChar, Value = User.Identity.Name
                }
            };

            DataBase.UpdateDB(sp, sql, "ApplicationServices");
            //Send email with ticket data
            string test2 = DateTime.Now.Subtract(DateTime.UtcNow).ToString();
            string test3 = test2.Substring(0, test2.IndexOf(":"));
            string msg   = @"
<b><h3>TICKET #: " + tbTicket.Text + @"</h3></b>
<b><h3>SEVERITY: " + cbSeverity.Text + @"</h3></b>
Ticket and Contact Details: <br/><br/>
<table style = ""width: 80 %; "" border = ""2"" cellpadding = ""4"">
<tr>
    <td style = ""width: 26 %; "">Creation Date and Time (local)</td>
    <td style = ""width: 73 %;""> " + DateTime.Now.ToLocalTime() + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "">Creation Date and Time (utc)</td>
    <td style = ""width: 73 %;""> " + DateTime.Now.ToUniversalTime() + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "">Creation Time Zone</td>
    <td style = ""width: 73 %;""> " + test3 + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "">Customer - Branch</td>
    <td style = ""width: 73 %; ""> " + tbBranch.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "">Creator Name</td></td>
    <td style = ""width: 73 %; ""> " + tbName.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "" >Creator Title</td>
    <td style = ""width: 73 %; "" > " + tbTitle.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "" >Creator Email</td>
    <td style = ""width: 73 %; "" > " + tbEmail.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "" >Group Emails</td>
    <td style = ""width: 73 %; "" > " + glGroup.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "">Work Phone</td></td>
    <td style = ""width: 73 %; ""> " + tbWork.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "" >Mobile Phone</td>
    <td style = ""width: 73 %; "" > " + tbMobile.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "" >Has WhatsApp</td>
    <td style = ""width: 73 %; "" > " + chWhats.Checked.ToString() + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "" >Additional Contact Instruction</td>
    <td style = ""width: 73 %; "" > " + tbContactInstructions.Text + @" </td>
</tr>

</table> ";

            msg += "<br/>";
            msg += "<br/>";
            msg += "Site Details:<br/><br/>";
            msg += @"
<table style = ""width: 80 %; "" border = ""2"" cellpadding = ""4"">
<tr>
    <td style = ""width: 26 %; "">OEM</td>
    <td style = ""width: 73 %;""> " + cbOEM.SelectedItem.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "">Technology</td>
    <td style = ""width: 73 %; ""> " + cbTech.SelectedItem.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "">Network Elements</td>
    <td style = ""width: 73 %; ""> " + cbElement.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "">Controller</td>
    <td style = ""width: 73 %; ""> " + cbController.SelectedItem.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "" >Controller IP Access Information</td>
    <td style = ""width: 73 %; "" > " + txtControllerIP.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "" >Site</td>
    <td style = ""width: 73 %; "" > " + glSites.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "" >Site IP Access Information</td>
    <td style = ""width: 73 %; "" > " + txtSiteIP.Text + @" </td>
</tr>
</table> ";
            msg += "<br/>";
            msg += "<br/>";
            msg += "Problem Details:<br/><br/>";
            msg += @"
<table style = ""width: 80 %; "" border = ""2"" cellpadding = ""4"">
<tr>
    <td style = ""width: 26 %; "">Problem Title</td>
    <td style = ""width: 73 %;""> " + tbProblem.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "">Problem</td>
    <td style = ""width: 73 %; ""> " + meProblem.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "">Remedy</td>
    <td style = ""width: 73 %; ""> " + tbRemedy.Text + @" </td>
</tr>
<tr>
    <td style = ""width: 26 %; "">Software Release</td>
    <td style = ""width: 73 %; ""> " + tbRelease.Text + @" </td>
</tr>
</table> ";

            //saving ticket to the DB
            sql = @"INSERT INTO tblTicket
(ID, CreationDate,CreationDateUtc,UserName,SeverityID,OEMID,TechnologyID,NetworkElementID,RadioControllerID
,ProblemTitle,ProblemDescription,SoftwareRelease,ContactInstructions,Remedy, SiteIP, ControllerIP, BranchID, Sites)
VALUES
(@ID, @CreationDate,@CreationDateUtc,@UserName,@SeverityID,@OEMID,@TechnologyID,@NetworkElementID,@RadioControllerID,
@ProblemTitle,@ProblemDescription,@SoftwareRelease,@ContactInstructions,@Remedy, @SiteIP, @ControllerIP, @BranchID, @Sites)";
            sp  = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@ID", SqlDbType = SqlDbType.BigInt, Value = Session["Ticket"]
                },
                new SqlParameter()
                {
                    ParameterName = "@CreationDate", SqlDbType = SqlDbType.DateTime, Value = DateTime.Now.ToLocalTime()
                },
                new SqlParameter()
                {
                    ParameterName = "@CreationDateUtc", SqlDbType = SqlDbType.DateTime, Value = DateTime.Now.ToUniversalTime()
                },
                new SqlParameter()
                {
                    ParameterName = "@UserName", SqlDbType = SqlDbType.NVarChar, Value = User.Identity.Name
                },
                new SqlParameter()
                {
                    ParameterName = "@SeverityID", SqlDbType = SqlDbType.Int, Value = cbSeverity.Value
                },
                new SqlParameter()
                {
                    ParameterName = "@OEMID", SqlDbType = SqlDbType.Int, Value = cbOEM.Value
                },
                new SqlParameter()
                {
                    ParameterName = "@TechnologyID", SqlDbType = SqlDbType.Int, Value = cbTech.Value
                },
                new SqlParameter()
                {
                    ParameterName = "@RadioControllerID", SqlDbType = SqlDbType.Int, Value = cbController.Value
                },
                new SqlParameter()
                {
                    ParameterName = "@ProblemTitle", SqlDbType = SqlDbType.NVarChar, Value = tbProblem.Text
                },
                new SqlParameter()
                {
                    ParameterName = "@ProblemDescription", SqlDbType = SqlDbType.NVarChar, Value = meProblem.Text
                },
                new SqlParameter()
                {
                    ParameterName = "@SoftwareRelease", SqlDbType = SqlDbType.NVarChar, Value = tbRelease.Text
                },
                new SqlParameter()
                {
                    ParameterName = "@ContactInstructions", SqlDbType = SqlDbType.NVarChar, Value = tbContactInstructions.Text
                },
                new SqlParameter()
                {
                    ParameterName = "@Remedy", SqlDbType = SqlDbType.NVarChar, Value = tbRemedy.Text
                },
                new SqlParameter()
                {
                    ParameterName = "@SiteIP", SqlDbType = SqlDbType.NVarChar, Value = txtSiteIP.Text
                },
                new SqlParameter()
                {
                    ParameterName = "@ControllerIP", SqlDbType = SqlDbType.NVarChar, Value = txtControllerIP.Text
                },
                new SqlParameter()
                {
                    ParameterName = "@BranchID", SqlDbType = SqlDbType.Int, Value = Session["BranchID"]
                },
                new SqlParameter()
                {
                    ParameterName = "@Sites", SqlDbType = SqlDbType.NVarChar, Value = glSites.Text
                }
            };

            //not required comboboxes
            SqlParameter singleparameter = new SqlParameter()
            {
                ParameterName = "@NetworkElementID",
                SqlDbType     = SqlDbType.Int,
            };

            if (cbElement.Value == null)
            {
                singleparameter.Value = DBNull.Value;
            }
            else
            {
                singleparameter.Value = cbElement.Value;
            }
            sp.Add(singleparameter);

            DataBase.UpdateDB(sp, sql);

            //update the groups
            //go through the list of selected group emails (if any)
            for (int i = 0; i < glGroup.GridView.Selection.Count; i++)
            {
                sql = "INSERT INTO tblGroupSelection (TicketID, GroupID) VALUES (@TicketID, @GroupID)";
                sp  = new List <SqlParameter>()
                {
                    new SqlParameter()
                    {
                        ParameterName = "@TicketID", SqlDbType = SqlDbType.BigInt, Value = Session["Ticket"]
                    },
                    new SqlParameter()
                    {
                        ParameterName = "@GroupID", SqlDbType = SqlDbType.BigInt, Value = glGroup.GridView.GetSelectedFieldValues("ID")[i]
                    }
                };
                DataBase.UpdateDB(sp, sql);
            }

            //update the sites
            //go through the list of selected sites (if any)
            for (int i = 0; i < glSites.GridView.Selection.Count; i++)
            {
                sql = "INSERT INTO tblSiteSelection (TicketID, SiteID) VALUES (@TicketID, @SiteID)";
                sp  = new List <SqlParameter>()
                {
                    new SqlParameter()
                    {
                        ParameterName = "@TicketID", SqlDbType = SqlDbType.BigInt, Value = Session["Ticket"]
                    },
                    new SqlParameter()
                    {
                        ParameterName = "@SiteID", SqlDbType = SqlDbType.BigInt, Value = glSites.GridView.GetSelectedFieldValues("ID")[i]
                    }
                };
                DataBase.UpdateDB(sp, sql);
            }

            //Set up title

            string queryCompanyBranch = "SELECT SUBSTRING(t2.Name, 1, 3) as company, case when CHARINDEX('-', t1.Name) > 0 then SUBSTRING(t1.Name, CHARINDEX('-', t1.Name) + 1, 3)";

            queryCompanyBranch += " when len(t1.Name) = 4 then SUBSTRING(t1.Name, 1, 4) else SUBSTRING(t1.Name, 1, 3) end as branch FROM tblBranch t1 INNER JOIN tblCompany t2 ON t2.ID = t1.CompanyID WHERE t1.ID = @ID";
            List <SqlParameter> parCB = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@ID", SqlDbType = SqlDbType.Int, Value = Session["BranchID"]
                }
            };
            DataTable dtCompanyBranch = DataBase.GetDT(parCB, queryCompanyBranch);

            string priority = cbSeverity.Text.Split(' ').Length > 1 ? cbSeverity.Text.Split(' ')[1].Trim() : cbSeverity.Text;
            string title    = string.Format("{0} {1} Ticket # {2} {3} {4}", dtCompanyBranch.Rows[0]["company"].ToString().ToUpper(), dtCompanyBranch.Rows[0]["branch"].ToString().ToUpper(), tbTicket.Text, tbProblem.Text, priority);

            //sending to Amerinode internally
            //Notifications.add(title, msg, "*****@*****.**", "*****@*****.**", Convert.ToInt64(Session["Ticket"]));
            lblMsg.Text = "Email sent to Amerinode Support at [email protected] for immediate processing.";
            Email.SendEmail(title, msg, "*****@*****.**");
            //sending to the tiket creator
            //Notifications.add(title, msg, "*****@*****.**", tbEmail.Text, Convert.ToInt64(Session["Ticket"]));
            Email.SendEmail(title, msg, tbEmail.Text);
            //Sending email to selected groups
            for (int i = 0; i < glGroup.GridView.Selection.Count; i++)
            {
                //Notifications.add(title, msg, "*****@*****.**", glGroup.GridView.GetSelectedFieldValues("GroupEmail")[i].ToString(), Convert.ToInt64(Session["Ticket"]));
                Email.SendEmail(title, msg, glGroup.GridView.GetSelectedFieldValues("GroupEmail")[i].ToString());
            }
            lblMsg.Text          += System.Environment.NewLine + "Q also sent emails to Ticket Creator: " + tbEmail.Text + " and designated groups: " + glGroup.Text;
            popMsg.ShowOnPageLoad = true;
            btOpen.Enabled        = false;
        }
Ejemplo n.º 54
0
        protected bool InviaMail(string nomeFoglio, object siglaEntita, List <Range> export)
        {
            string fileNameFull = "";
            string fileName     = "";

            try
            {
                Excel.Worksheet ws = Globals.ThisWorkbook.Sheets[nomeFoglio];

                DataView entitaProprieta = Workbook.Repository[DataBase.TAB.ENTITA_PROPRIETA].DefaultView;
                entitaProprieta.RowFilter = "SiglaEntita = '" + siglaEntita + "' AND SiglaProprieta = 'SISTEMA_COMANDI_ALLEGATO_EXCEL' AND IdApplicazione = " + Workbook.IdApplicazione;
                if (entitaProprieta.Count > 0)
                {
                    fileName     = entitaProprieta[0]["Valore"] + "_VDT_" + Workbook.DataAttiva.ToString("yyyyMMdd") + ".xls";
                    fileNameFull = Environment.ExpandEnvironmentVariables(@"%TEMP%\" + fileName);
                    //fileName = @"D:\" + entitaProprieta[0]["Valore"] + "_VDT_" + Workbook.DataAttiva.ToString("yyyyMMdd") + ".xls";

                    Excel.Workbook wb = Globals.ThisWorkbook.Application.Workbooks.Add();
                    int            i  = 2;
                    foreach (Range rng in export)
                    {
                        ws.Range[rng.ToString()].Copy();
                        wb.Sheets[1].Range["B" + i++].PasteSpecial();
                    }
                    wb.Sheets[1].Columns["B:C"].EntireColumn.AutoFit();
                    wb.Sheets[1].Range["A1"].Select();
                    wb.SaveAs(fileNameFull, Excel.XlFileFormat.xlExcel12);
                    wb.Close();
                    Marshal.ReleaseComObject(wb);

                    var    config = Workbook.GetUsrConfigElement("destMailTest");
                    string mailTo = config.Test;
                    string mailCC = "";

                    if (Workbook.Ambiente == Simboli.PROD)
                    {
                        entitaProprieta.RowFilter = "SiglaEntita = '" + siglaEntita + "' AND SiglaProprieta = 'SISTEMA_COMANDI_MAIL_TO' AND IdApplicazione = " + Workbook.IdApplicazione;
                        mailTo = entitaProprieta[0]["Valore"].ToString();
                        entitaProprieta.RowFilter = "SiglaEntita = '" + siglaEntita + "' AND SiglaProprieta = 'SISTEMA_COMANDI_MAIL_CC' AND IdApplicazione = " + Workbook.IdApplicazione;
                        mailCC = entitaProprieta[0]["Valore"].ToString();
                    }

                    entitaProprieta.RowFilter = "SiglaEntita = '" + siglaEntita + "' AND SiglaProprieta = 'SISTEMA_COMANDI_CODICE_MAIL' AND IdApplicazione = " + Workbook.IdApplicazione;
                    string codUP = entitaProprieta[0]["Valore"].ToString();

                    config = Workbook.GetUsrConfigElement("oggettoMail");
                    string oggetto = config.Value.Replace("%COD%", codUP).Replace("%DATA%", Workbook.DataAttiva.ToString("dd-MM-yyyy"));
                    config = Workbook.GetUsrConfigElement("messaggioMail");
                    string messaggio = config.Value;
                    messaggio = Regex.Replace(messaggio, @"^[^\S\r\n]+", "", RegexOptions.Multiline);

                    if (DataBase.OpenConnection())
                    {
                        Outlook.Application outlook = GetOutlookInstance();
                        Outlook._MailItem   mail    = outlook.CreateItem(Outlook.OlItemType.olMailItem);

                        //TODO check se manda sempre con lo stesso account...
                        Outlook.Account senderAccount = outlook.Session.Accounts[1];
                        foreach (Outlook.Account account in outlook.Session.Accounts)
                        {
                            if (account.DisplayName == "Bidding")
                            {
                                senderAccount = account;
                            }
                        }
                        mail.SendUsingAccount = senderAccount;
                        mail.Subject          = oggetto;
                        mail.Body             = messaggio;
                        foreach (string dest in mailTo.Split(';'))
                        {
                            if (dest.Trim() != "")
                            {
                                mail.Recipients.Add(dest.Trim());
                            }
                        }
                        mail.CC = mailCC;
                        mail.Attachments.Add(fileNameFull);

                        mail.Send();

                        File.Delete(fileNameFull);
                    }
                    else
                    {
                        string emailFolder = @"C:\Emergenza\Email\" + Simboli.NomeApplicazione;

                        if (!Directory.Exists(emailFolder))
                        {
                            Directory.CreateDirectory(emailFolder);
                        }

                        File.Move(fileNameFull, Path.Combine(emailFolder, fileName));
                    }
                }
            }
            catch (Exception e)
            {
                Workbook.InsertLog(Core.DataBase.TipologiaLOG.LogErrore, "SistemaComandi.Esporta.InvioMail [" + siglaEntita + "]: " + e.Message);

                System.Windows.Forms.MessageBox.Show(e.Message, Simboli.NomeApplicazione + " - ERRORE!!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);

                if (File.Exists(fileNameFull))
                {
                    File.Delete(fileNameFull);
                }

                return(false);
            }

            return(true);
        }
Ejemplo n.º 55
0
        private string SumAllMember()
        {
            string        text2   = "";
            string        text3   = "";
            string        text4   = "";
            int           index   = 0;
            DataBase      base2   = new DataBase(MyFunc.GetConnStr(2));
            DataBase      base3   = new DataBase(MyFunc.GetConnStr(1));
            SqlDataReader reader  = null;
            SqlDataReader reader2 = null;
            DataSet       set     = null;
            double        num3    = 0;

            string[] textArray = "01,11,21,31,41,总单,02,12,22,32,42,总双,03,13,23,33,43,总大,04,14,24,34,44,总小,05,15,25,35,45,06,16,26,36,46,07,17,27,37,47,08,18,28,38,48,09,19,29,39,49,10,20,30,40".Split(new char[] { ',' });
            reader = base2.ExecuteReader("SELECT top 1 convert(nvarchar,updatetime,11) as updatetime,content,qishu,kaisai FROM affiche WHERE le=1 ORDER BY updatetime DESC");
            if (reader.Read())
            {
                DateTime time = Convert.ToDateTime(reader["kaisai"].ToString().Trim());
                TimeSpan span = DateTime.Now.Subtract(time);
                int      num4 = ((span.Days * 0x5a0) + (span.Hours * 60)) + span.Minutes;
                if (num4 < 360)
                {
                    object obj2 = text2;
                    text2 = string.Concat(new object[] { obj2, "<tr bgcolor='#FFFFFF' ><td rowspan=10>", reader["kaisai"].ToString().Split(new char[] { ' ' })[0].ToString().Trim(), "<BR>", reader["kaisai"].ToString().Split(new char[] { ' ' })[1].ToString().Trim(), "</td><td rowspan=10 align=center>", reader["qishu"], "</td>" });
                    text4 = reader["kaisai"].ToString();
                    reader.Close();
                    set = base3.ExecuteDataSet("SELECT v1.*,isnull((cl.giveup1sum-cl.giveup2sum)/cl.giveupmoney*giveuppl,0) as give FROM Pl as v1 LEFT JOIN changeleave as cl ON (v1.id = cl.ballid AND cl.gsid = '" + this.Session["usergsid"].ToString() + "')  where ((id>6 and id<11 )or (id>83 and id <133)) order by id asc");
                    for (int i = 0; i < 10; i++)
                    {
                        if (i != 0)
                        {
                            text2 = text2 + "<tr bgcolor='#FFFFFF' >";
                        }
                        if (this.Session["sessionSelectStaticCS"].ToString() == "全部")
                        {
                            reader2 = base2.ExecuteReader("select max(tztype) as tztype,max(tzteam) as tzteam,count(1) as orderno,isnull(sum(tzmoney),0) as summoney from ball_order where DATEDIFF(dd, GETDATE(), updatetime)=0 and gdid = '" + this.Session["adminuserid"].ToString() + "' and ballid=" + set.Tables[0].Rows[i + 4]["id"].ToString().Trim() + " group by ballid order by ballid asc");
                        }
                        else
                        {
                            reader2 = base2.ExecuteReader("select max(tztype) as tztype,max(tzteam) as tzteam,count(1) as orderno,isnull(sum(tzmoney*csgd),0) as summoney from ball_order where DATEDIFF(dd, GETDATE(), updatetime)=0 and gdid = '" + this.Session["adminuserid"].ToString() + "' and ballid=" + set.Tables[0].Rows[i + 4]["id"].ToString().Trim() + " group by ballid order by ballid desc");
                        }
                        text3 = double.Parse(MyFunc.GetPlType(set.Tables[0].Rows[i + 4]["pl"].ToString().Trim(), "0", set.Tables[0].Rows[i + 4]["give"].ToString().Trim(), "H", "0").ToString("F2")).ToString();
                        string text6 = text2;
                        text2 = text6 + "<td align=center background=" + MyFunc.GetRGB(textArray[index]) + " class=nums><font color=" + MyFunc.GetRGB(int.Parse(textArray[index])) + " size=3><b>" + textArray[index++] + "</b></font></td>";
                        if (reader2.Read())
                        {
                            string text7 = text2;
                            text2 = text7 + "<td align=center class=tznumer>" + text3 + "   <br>  <a href='tzinfo.aspx?gameid=" + set.Tables[0].Rows[i + 4]["id"].ToString().Trim() + "&tztype=9&marker=C'>  <font color=#000088>" + double.Parse(reader2["summoney"].ToString()).ToString() + "</font></a></td> ";
                            num3 += double.Parse(reader2["summoney"].ToString());
                        }
                        else
                        {
                            text2 = text2 + "<td align=center class=tznumer>" + text3 + "   <br>    <font color=#000088>0</font></a></td> ";
                        }
                        reader2.Close();
                        if (this.Session["sessionSelectStaticCS"].ToString() == "全部")
                        {
                            reader2 = base2.ExecuteReader("select max(tztype) as tztype,max(tzteam) as tzteam,count(1) as orderno,isnull(sum(tzmoney),0) as summoney from ball_order where DATEDIFF(dd, GETDATE(), updatetime)=0 and gdid = '" + this.Session["adminuserid"].ToString() + "' and ballid=" + set.Tables[0].Rows[i + 14]["id"].ToString().Trim() + " group by ballid order by ballid asc");
                        }
                        else
                        {
                            reader2 = base2.ExecuteReader("select max(tztype) as tztype,max(tzteam) as tzteam,count(1) as orderno,isnull(sum(tzmoney*csgd),0) as summoney from ball_order where DATEDIFF(dd, GETDATE(), updatetime)=0 and gdid = '" + this.Session["adminuserid"].ToString() + "' and ballid=" + set.Tables[0].Rows[i + 14]["id"].ToString().Trim() + " group by ballid order by ballid desc");
                        }
                        text3 = double.Parse(MyFunc.GetPlType(set.Tables[0].Rows[i + 14]["pl"].ToString().Trim(), "0", set.Tables[0].Rows[i + 14]["give"].ToString().Trim(), "H", "0").ToString("F2")).ToString();
                        string text8 = text2;
                        text2 = text8 + "<td align=center background=" + MyFunc.GetRGB(textArray[index]) + " class=nums><font color=" + MyFunc.GetRGB(int.Parse(textArray[index])) + " size=3><b>" + textArray[index++] + "</b></font></td>";
                        if (reader2.Read())
                        {
                            string text9 = text2;
                            text2 = text9 + "<td align=center class=tznumer>" + text3 + "   <br>  <a href='tzinfo.aspx?gameid=" + set.Tables[0].Rows[i + 14]["id"].ToString().Trim() + "&tztype=9&marker=C'>  <font color=#000088>" + double.Parse(reader2["summoney"].ToString()).ToString() + "</font></a></td> ";
                            num3 += double.Parse(reader2["summoney"].ToString());
                        }
                        else
                        {
                            text2 = text2 + "<td align=center class=tznumer>" + text3 + "   <br>    <font color=#000088>0</font></a></td> ";
                        }
                        reader2.Close();
                        if (this.Session["sessionSelectStaticCS"].ToString() == "全部")
                        {
                            reader2 = base2.ExecuteReader("select max(tztype) as tztype,max(tzteam) as tzteam,count(1) as orderno,isnull(sum(tzmoney),0) as summoney from ball_order where DATEDIFF(dd, GETDATE(), updatetime)=0 and gdid = '" + this.Session["adminuserid"].ToString() + "' and ballid=" + set.Tables[0].Rows[i + 0x18]["id"].ToString().Trim() + " group by ballid order by ballid asc");
                        }
                        else
                        {
                            reader2 = base2.ExecuteReader("select max(tztype) as tztype,max(tzteam) as tzteam,count(1) as orderno,isnull(sum(tzmoney*csgd),0) as summoney from ball_order where DATEDIFF(dd, GETDATE(), updatetime)=0 and gdid = '" + this.Session["adminuserid"].ToString() + "' and ballid=" + set.Tables[0].Rows[i + 0x18]["id"].ToString().Trim() + " group by ballid order by ballid desc");
                        }
                        text3 = double.Parse(MyFunc.GetPlType(set.Tables[0].Rows[i + 0x18]["pl"].ToString().Trim(), "0", set.Tables[0].Rows[i + 0x18]["give"].ToString().Trim(), "H", "0").ToString("F2")).ToString();
                        string text10 = text2;
                        text2 = text10 + "<td align=center background=" + MyFunc.GetRGB(textArray[index]) + " class=nums><font color=" + MyFunc.GetRGB(int.Parse(textArray[index])) + " size=3><b>" + textArray[index++] + "</b></font></td>";
                        if (reader2.Read())
                        {
                            string text11 = text2;
                            text2 = text11 + "<td align=center class=tznumer>" + text3 + "   <br>  <a href='tzinfo.aspx?gameid=" + set.Tables[0].Rows[i + 0x18]["id"].ToString().Trim() + "&tztype=9&marker=C'>  <font color=#000088>" + double.Parse(reader2["summoney"].ToString()).ToString() + "</font></a></td> ";
                            num3 += double.Parse(reader2["summoney"].ToString());
                        }
                        else
                        {
                            text2 = text2 + "<td align=center class=tznumer>" + text3 + "   <br>    <font color=#000088>0</font></a></td> ";
                        }
                        reader2.Close();
                        if (this.Session["sessionSelectStaticCS"].ToString() == "全部")
                        {
                            reader2 = base2.ExecuteReader("select max(tztype) as tztype,max(tzteam) as tzteam,count(1) as orderno,isnull(sum(tzmoney),0) as summoney from ball_order where DATEDIFF(dd, GETDATE(), updatetime)=0 and gdid = '" + this.Session["adminuserid"].ToString() + "' and ballid=" + set.Tables[0].Rows[i + 0x22]["id"].ToString().Trim() + " group by ballid order by ballid asc");
                        }
                        else
                        {
                            reader2 = base2.ExecuteReader("select max(tztype) as tztype,max(tzteam) as tzteam,count(1) as orderno,isnull(sum(tzmoney*csgd),0) as summoney from ball_order where DATEDIFF(dd, GETDATE(), updatetime)=0 and gdid = '" + this.Session["adminuserid"].ToString() + "' and ballid=" + set.Tables[0].Rows[i + 0x22]["id"].ToString().Trim() + " group by ballid order by ballid desc");
                        }
                        text3 = double.Parse(MyFunc.GetPlType(set.Tables[0].Rows[i + 0x22]["pl"].ToString().Trim(), "0", set.Tables[0].Rows[i + 0x22]["give"].ToString().Trim(), "H", "0").ToString("F2")).ToString();
                        string text12 = text2;
                        text2 = text12 + "<td align=center background=" + MyFunc.GetRGB(textArray[index]) + " class=nums><font color=" + MyFunc.GetRGB(int.Parse(textArray[index])) + " size=3><b>" + textArray[index++] + "</b></font></td>";
                        if (reader2.Read())
                        {
                            string text13 = text2;
                            text2 = text13 + "<td align=center class=tznumer>" + text3 + "   <br>  <a href='tzinfo.aspx?gameid=" + set.Tables[0].Rows[i + 0x22]["id"].ToString().Trim() + "&tztype=9&marker=C'>  <font color=#000088>" + double.Parse(reader2["summoney"].ToString()).ToString() + "</font></a></td> ";
                            num3 += double.Parse(reader2["summoney"].ToString());
                        }
                        else
                        {
                            text2 = text2 + "<td align=center class=tznumer>" + text3 + "   <br>    <font color=#000088>0</font></a></td> ";
                        }
                        reader2.Close();
                        if (i < 9)
                        {
                            if (this.Session["sessionSelectStaticCS"].ToString() == "全部")
                            {
                                reader2 = base2.ExecuteReader("select max(tztype) as tztype,max(tzteam) as tzteam,count(1) as orderno,isnull(sum(tzmoney),0) as summoney from ball_order where DATEDIFF(dd, GETDATE(), updatetime)=0 and gdid = '" + this.Session["adminuserid"].ToString() + "' and ballid=" + set.Tables[0].Rows[i + 0x2c]["id"].ToString().Trim() + " group by ballid order by ballid asc");
                            }
                            else
                            {
                                reader2 = base2.ExecuteReader("select max(tztype) as tztype,max(tzteam) as tzteam,count(1) as orderno,isnull(sum(tzmoney*csgd),0) as summoney from ball_order where DATEDIFF(dd, GETDATE(), updatetime)=0 and gdid = '" + this.Session["adminuserid"].ToString() + "' and ballid=" + set.Tables[0].Rows[i + 0x2c]["id"].ToString().Trim() + " group by ballid order by ballid desc");
                            }
                            text3 = double.Parse(MyFunc.GetPlType(set.Tables[0].Rows[i + 0x2c]["pl"].ToString().Trim(), "0", set.Tables[0].Rows[i + 0x2c]["give"].ToString().Trim(), "H", "0").ToString("F2")).ToString();
                            string text14 = text2;
                            text2 = text14 + "<td align=center background=" + MyFunc.GetRGB(textArray[index]) + " class=nums><font color=" + MyFunc.GetRGB(int.Parse(textArray[index])) + " size=3><b>" + textArray[index++] + "</b></font></td>";
                            if (reader2.Read())
                            {
                                string text15 = text2;
                                text2 = text15 + "<td align=center class=tznumer>" + text3 + "   <br>  <a href='tzinfo.aspx?gameid=" + set.Tables[0].Rows[i + 0x2c]["id"].ToString().Trim() + "&tztype=9&marker=C'>  <font color=#000088>" + double.Parse(reader2["summoney"].ToString()).ToString() + "</font></a></td> ";
                                num3 += double.Parse(reader2["summoney"].ToString());
                            }
                            else
                            {
                                text2 = text2 + "<td align=center class=tznumer>" + text3 + "   <br>    <font color=#000088>0</font></a></td> ";
                            }
                            reader2.Close();
                        }
                        else
                        {
                            text2 = text2 + "<td colspan=2>&nbsp;</td>";
                        }
                        if (i < 4)
                        {
                            if (this.Session["sessionSelectStaticCS"].ToString() == "全部")
                            {
                                reader2 = base2.ExecuteReader("select max(tztype) as tztype,max(tzteam) as tzteam,count(1) as orderno,isnull(sum(tzmoney),0) as summoney from ball_order where DATEDIFF(dd, GETDATE(), updatetime)=0 and gdid = '" + this.Session["adminuserid"].ToString() + "' and ballid=" + set.Tables[0].Rows[i]["id"].ToString().Trim() + " group by ballid order by ballid asc");
                            }
                            else
                            {
                                reader2 = base2.ExecuteReader("select max(tztype) as tztype,max(tzteam) as tzteam,count(1) as orderno,isnull(sum(tzmoney*csgd),0) as summoney from ball_order where DATEDIFF(dd, GETDATE(), updatetime)=0 and gdid = '" + this.Session["adminuserid"].ToString() + "' and ballid=" + set.Tables[0].Rows[i]["id"].ToString().Trim() + " group by ballid order by ballid desc");
                            }
                            text3 = double.Parse(MyFunc.GetPlType(set.Tables[0].Rows[i]["pl"].ToString().Trim(), this.Session.Contents["ABC"].ToString().Trim(), set.Tables[0].Rows[i]["give"].ToString().Trim(), "H", "0").ToString("F2")).ToString();
                            text2 = text2 + "<td align=center>" + textArray[index++] + "</td>";
                            if (reader2.Read())
                            {
                                object   obj3      = text2;
                                object[] objArray2 = new object[] { obj3, "<td align=center class=tznumer>", text3, "   <br>  <a href='tzinfo.aspx?gameid=", set.Tables[0].Rows[i]["id"].ToString().Trim(), "&tztype=", int.Parse(((i + 8) / 2).ToString()), "&marker=C'>  <font color=#000088>", double.Parse(reader2["summoney"].ToString()).ToString(), "</font></a></td> </tr>" };
                                text2 = string.Concat(objArray2);
                            }
                            else
                            {
                                text2 = text2 + "<td align=center class=tznumer>" + text3 + "   <br>    <font color=#000088>0</font></a></td> ";
                            }
                            reader2.Close();
                        }
                        else
                        {
                            text2 = text2 + "<td colspan=2>&nbsp;</td></tr>";
                        }
                    }
                    set.Dispose();
                }
            }
            reader.Close();
            base3.CloseConnect();
            base3.Dispose();
            base2.CloseConnect();
            base2.Dispose();
            string text16 = text2;

            string[] textArray24 = new string[8];
            textArray24[0] = text16;
            textArray24[1] = "<tr bgcolor='#ffffff' height='25' ><td colspan=14>本页总额<b><font color=blue>";
            textArray24[2] = num3.ToString();
            textArray24[3] = "</font></b>元(49粒),码均<b><font color=black>";
            textArray24[4] = (num3 / 49).ToString("F2");
            textArray24[5] = "</font></b>元;按陪率42(12水)估算:如中到<b><font color=red>";
            double num26 = (num3 * 0.88) / 7.1;

            textArray24[6] = double.Parse(num26.ToString()).ToString("F2");
            textArray24[7] = "</font></b>元投注额,本项目您将输彩</td></tr>";
            return(string.Concat(textArray24) + "\n</table></form></body></html>");
        }
Ejemplo n.º 56
0
        /// <summary>
        /// 進捗データ取得
        /// </summary>
        /// <param name="dpyno">伝票No</param>
        /// <param name="process">工程コード</param>
        /// <remarks>
        /// 作成者    :  sesaki
        /// 作成日    :  2019/09/24
        /// </remarks>
        private void GetMgmt(string dpyno, string process)
        {
            DataSet  dtSet    = null;
            DataBase dataBase = null;

            try
            {
                dataBase = new DataBase();
                List <object> paraList = new List <object>();
                string        sqlStr   = QueryBuild.GetSappanMgmt(dpyno, ref paraList);


                dataBase.ConnectDB();
                dtSet = dataBase.GetDataSet(sqlStr, paraList.ToArray());

                dataBase.DisconnectDB();

                foreach (DataRow row in dtSet.Tables[0].Rows)
                {
                    string cd           = row["PROCESS_CD"].ToString();
                    bool   disabled_flg = (cd != process);
                    switch (cd)
                    {
                    case Constants.PROCESS_SPNSEIZO:
                        Sappans = new Register(row, disabled_flg);
                        break;

                    case Constants.PROCESS_SPNKENSA:
                        Sappank = new Register(row, disabled_flg);
                        break;

                    case Constants.PROCESS_HENSHU:
                        switch (row["SUBPROCESS_CD"].ToString())
                        {
                        case Constants.PROCESS_SUB1:
                            Henshus = new Register(row, disabled_flg);
                            break;

                        case Constants.PROCESS_SUB2:
                            Henshuk = new Register(row, disabled_flg);
                            break;

                        default:
                            Henshus = new Register(row, disabled_flg);
                            Henshuk = new Register(row, disabled_flg);
                            break;
                        }
                        break;

                    case Constants.PROCESS_KENSA:
                        Kensa = new Register(row, disabled_flg);
                        break;

                    case Constants.PROCESS_GYOUMU:
                        Gyoumu = new Register(row, disabled_flg);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorGetMgmtMessage = Resources.TextResource.ErrorGetMgmt;
            }
            finally
            {
                if (dataBase != null)
                {
                    dataBase.DisconnectDB();
                }
                if (dtSet != null)
                {
                    dtSet.Dispose();
                }
            }
        }
Ejemplo n.º 57
0
 public async Task SaveUser()
 {
     await DataBase.CommitAsync();
 }
Ejemplo n.º 58
0
        private async void VerificaClassificadoBaseLocal()
        {
            if (DataBase.GetClassificado() != null)
            {
                try
                {
                    var dadosSituacao = await SituacaoClassificadoService.VerificaSituacaoClassificado(DataBase.GetAppKey());

                    var dadosClassificadoLocal = DataBase.GetClassificado();

                    Situacao                = dadosSituacao.situacao;
                    Observacao              = dadosSituacao.obs;
                    CategoriaSelecionada    = ListaCategoria.ToList().Find(c => c.categoria == dadosClassificadoLocal.categ);
                    SubCategoriaSelecionada = ListaSubCategoria.ToList().Find(s => s.subcategoria == dadosClassificadoLocal.subcateg);
                    Titulo       = dadosClassificadoLocal.titulo;
                    Texto        = dadosClassificadoLocal.texto;
                    Hora1Inicial = ListaHoras.ToList().Find(h => h.Horas == dadosClassificadoLocal.contato_h1.Substring(0, 5));
                    Hora1Final   = ListaHoras.ToList().Find(h => h.Horas == dadosClassificadoLocal.contato_h1.Substring(5, 5));
                    Hora2Inicial = ListaHoras.ToList().Find(h => h.Horas == dadosClassificadoLocal.contato_h2.Substring(0, 5));
                    Hora2Final   = ListaHoras.ToList().Find(h => h.Horas == dadosClassificadoLocal.contato_h2.Substring(5, 5));
                    Telefone     = dadosClassificadoLocal.contato_tel;
                    Email        = dadosClassificadoLocal.contato_email;
                }
                catch (Exception erro)
                {
                    await App.Current.MainPage.DisplayAlert("Erro", "Erro => " + erro, "Ok");
                }
            }
        }
        /**
         * Cria a relação para pontosrotulopaciente, contendo um id gerado automaticamente pelo banco como chave primária.
         */
        public static void Create()
        {
            string query = "CREATE TABLE IF NOT EXISTS PONTOSROTULOPACIENTE (idRotuloPaciente INTEGER primary key AUTOINCREMENT,idExercicio INTEGER not null,estagioMovimentoPaciente VARCHAR (30) not null,tempoInicial REAL not null,tempoFinal REAL not null,foreign key (idExercicio) references EXERCICIO (idExercicio));";

            DataBase.Create(query);
        }
Ejemplo n.º 60
0
 private void AppMain_Load(object sender, EventArgs e)
 {
     db = new DataBase();
     timerTime.Start();
     statusLabelOperator.Text = "当前操作员:" + PropertyClass.OperatorName;
 }