用于执行的 SQL 语句并返回结果
Ejemplo n.º 1
0
 public IList<AddressInfo> GetAddress(int userID)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     List<AddressInfo> Addresss = new List<AddressInfo>();
     SqlParameter[] objParams = new SqlParameter[1];
     objParams[0] = new SqlParameter("@userID", SqlDbType.Int, 4);
     objParams[0].Value = userID;
     SqlDataReader reader = objSqlHelper.ExecuteReader("je_Ad_GetAddress", objParams);
     while (reader.Read())
     {
         AddressInfo item = new AddressInfo();
         item.AddressID = reader.GetInt32(reader.GetOrdinal("addressID"));
         item.AddressName = reader.GetString(reader.GetOrdinal("addressName"));
         item.Address = reader.GetString(reader.GetOrdinal("address"));
         item.Post = reader.GetString(reader.GetOrdinal("Post"));
         item.Telephone = reader.GetString(reader.GetOrdinal("Telephone"));
         item.IsDefault = reader.GetBoolean(reader.GetOrdinal("isDefault"));
         item.Province = reader.GetString(reader.GetOrdinal("Province"));
         item.City = reader.GetString(reader.GetOrdinal("City"));
         item.SendType = reader.GetInt32(reader.GetOrdinal("SendType"));
         item.Name = reader.GetString(reader.GetOrdinal("Name"));
         Addresss.Add(item);
     }
     reader.Close();
     return Addresss;
 }
Ejemplo n.º 2
0
        private void buttonX2_Click(object sender, EventArgs e)
        {
            if (listView1.CheckedItems.Count != 0)
            {
                SqlHelper help = new SqlHelper();
                string condition = " where " + "Teacher='" + listView1.CheckedItems[0].SubItems[1].Text + "'";

                if (help.delete("Teachers_Data", condition) > 0)
                {
                    MessageBox.Show("删除成功");
                }
                else
                {
                    MessageBox.Show("删除失败");
                }

                listView1.Items.Clear();
                setTbEnable();
                clear_listview();
                totalpage = pageshow.totalpage("select * from Teachers_Data", pagesize, "Teachers_Data");
                labPageAll.Text = totalpage + "";
                textBoxNow.Text = currentpage.ToString();
                DataTable dt = pageshow.ListviewShow("select * from Teachers_Data", currentpage, pagesize, "Teachers_Data");
                UIShow show = new UIShow();
                show.teachers_listview_write(dt, listView1);

                groupBox1.SendToBack();
            }
        }
Ejemplo n.º 3
0
       public IList<CategoryInfo> GetCategory(CategoryType categoryType, int categoryID)
       {
           SqlHelper objSqlHelper = new SqlHelper();
           
           List<CategoryInfo> categorys = new List<CategoryInfo>();
           SqlParameter[] objParams = new SqlParameter[2];
           objParams[0] = new SqlParameter("@categoryType", SqlDbType.Int, 4);
           objParams[1] = new SqlParameter("@categoryID", SqlDbType.Int, 4);
           objParams[0].Value = (int)categoryType;
           objParams[1].Value = categoryID;

           SqlDataReader reader = objSqlHelper.ExecuteReader("je_Cat_GetCategory", objParams); ;
           while (reader.Read())
           {
               
               CategoryInfo item = new CategoryInfo();
               item.CategoryID = reader.GetInt32(reader.GetOrdinal("categoryID"));
               item.CategoryName = reader.GetString(reader.GetOrdinal("categoryName"));
               item.ParentID = reader.GetInt32(reader.GetOrdinal("parentID"));
               item.IsMain = reader.GetBoolean(reader.GetOrdinal("IsMain"));
               categorys.Add(item);
           }
           reader.Close();
           objSqlHelper.close();
           
           return categorys;
       }
Ejemplo n.º 4
0
        public AddressInfo GetAddressByID()
        {
            SqlHelper objSqlHelper = new SqlHelper();
            SqlParameter[] objParams = new SqlParameter[1];
            objParams[0] = new SqlParameter("@userName", SqlDbType.VarChar);

            objParams[0].Value = GetUserName();
            SqlDataReader reader = objSqlHelper.ExecuteReader("je_Ad_GetAddressByID", objParams);
            AddressInfo item = new AddressInfo();
            while (reader.Read())
            {
                item.UserName = reader.GetString(reader.GetOrdinal("userName"));
                item.AddressName = reader.GetString(reader.GetOrdinal("addressName"));
                item.Address = reader.GetString(reader.GetOrdinal("address"));
                item.Post = reader.GetString(reader.GetOrdinal("Post"));
                item.Telephone = reader.GetString(reader.GetOrdinal("Telephone"));
                item.Province = reader.GetString(reader.GetOrdinal("Province"));
                item.City = reader.GetString(reader.GetOrdinal("City"));
                item.SendType = reader.GetInt32(reader.GetOrdinal("SendType"));
                item.PayType = reader.GetInt32(reader.GetOrdinal("PayType"));
                item.Name = reader.GetString(reader.GetOrdinal("Name"));
                item.Price = reader.GetDecimal(reader.GetOrdinal("Price"));
                item.Balance = reader.GetDecimal(reader.GetOrdinal("Balance"));
            }
            reader.Close();
            return item;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Создает новую задачу.
        /// </summary>
        /// <param name="task">Задача.</param>
        /// <returns>Идентификатор созданной задачи.</returns>
        public int Create(TaskItem task)
        {
            using (var sqlh = new SqlHelper())
            {
                return sqlh.ExecScalar<int>(@"
            insert into Task.task
            (
            number,
            task_prefix,
            header,
            mem,
            deadline,
            priority,
            performer,
            author
            )
            values
            (
            @Number,
            (select top 1 p.task_prefix from Task.task_prefix p where p.code = @Prefix),
            @Header,
            @Mem,
            @Deadline,
            @Priority,
            @Performer,
            @Author
            )

            select scope_identity()", task);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// ����������ѯ�����б�
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public List<BuilderObject> GetBuilderByName(string where)
        {
            SqlHelper sh = new SqlHelper();
            ds = new DataSet();

            ds = sh.selectAll("builderObject", "buildName like '%" + where + "%'");

            list = new List<BuilderObject>();
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                BuilderObject boTemp = new BuilderObject();
                boTemp.BuilId = int.Parse(ds.Tables[0].Rows[i][0].ToString());
                boTemp.BuilName = ds.Tables[0].Rows[i][1].ToString();
               // boTemp.BuilItemID = ds.Tables[0].Rows[i][2].ToString();
                boTemp.BuilHeight = ds.Tables[0].Rows[i][2].ToString();
                boTemp.BuilArea = ds.Tables[0].Rows[i][3].ToString();
                boTemp.BuilInfo = ds.Tables[0].Rows[i][4].ToString();
                boTemp.BuilLongitude = ds.Tables[0].Rows[i][5].ToString();
                boTemp.BuilLatitude = ds.Tables[0].Rows[i][6].ToString();
                boTemp.BuidObjectID = ds.Tables[0].Rows[i][7].ToString();
                list.Add(boTemp);
            }

            return list;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// ������Ϣ��ID ��ѯ������Ϣ
        /// </summary>
        /// <param name="itemID"></param>
        /// <returns></returns>
        public List<BuilderObject> GetBuilderInfo(string ObjectID)
        {
            SqlHelper sh = new SqlHelper();
            ds = new DataSet();

            ds = sh.selectAll("builderObject", "buildObjectID='" + ObjectID + "'");
            list = new List<BuilderObject>();
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                BuilderObject boTemp = new BuilderObject();
                boTemp.BuilId           = int.Parse(ds.Tables[0].Rows[i][0].ToString());
                boTemp.BuilName         = ds.Tables[0].Rows[i][1].ToString();
                //������ǵ�i�еĵ�1�е�����
               // boTemp.BuilItemID       = ds.Tables[0].Rows[i][2].ToString();
                boTemp.BuilHeight       = ds.Tables[0].Rows[i][2].ToString();
                boTemp.BuilArea         = ds.Tables[0].Rows[i][3].ToString();
                boTemp.BuilInfo         = ds.Tables[0].Rows[i][4].ToString();
                boTemp.BuilLongitude    = ds.Tables[0].Rows[i][5].ToString();
                boTemp.BuilLatitude     = ds.Tables[0].Rows[i][6].ToString();
                boTemp.BuidObjectID = ds.Tables[0].Rows[i][7].ToString();
                //Tables��Rows���Ǽ��ϣ��������ǿ���ͨ���������������еij�Ա
                list.Add(boTemp);
            }

            return list;
        }
Ejemplo n.º 8
0
 public int DeleteTeacher(TeacherInfo teacher)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     SqlParameter[] objParams = new SqlParameter[1];
     objParams[0] = new SqlParameter("@ID", teacher.TeacherID);
     return objSqlHelper.ExecuteNonQuery("je_TE_DeleteTeacher", objParams);
 }
Ejemplo n.º 9
0
       public IList<ReviewInfo> GetReview(ReviewType rt, int ID)
       {
           SqlHelper objSqlHelper = new SqlHelper();
           List<ReviewInfo> reviews = new List<ReviewInfo>();
           SqlParameter[] objParams = new SqlParameter[2];
           objParams[0] = new SqlParameter("@reviewType", SqlDbType.Int, 4);
           objParams[1] = new SqlParameter("@ID", SqlDbType.Int, 4);
           objParams[0].Value = (int)rt;
           objParams[1].Value = ID;
           SqlDataReader reader = objSqlHelper.ExecuteReader("je_Reviews_GetReview", objParams);
           while (reader.Read())
           {
               ReviewInfo item = new ReviewInfo();
               item.ReviewID = reader.GetInt32(reader.GetOrdinal("ReviewID"));
               item.BookID = reader.GetInt32(reader.GetOrdinal("bookID"));
               item.PostIP = reader.GetString(reader.GetOrdinal("postIP"));
               item.PostTime = reader.GetDateTime(reader.GetOrdinal("postTime"));
               item.RateID = reader.GetInt32(reader.GetOrdinal("rate"));
               item.UserName = reader.GetString(reader.GetOrdinal("userName"));
               item.StatusID = reader.GetInt32(reader.GetOrdinal("status"));
               item.Content = reader.GetString(reader.GetOrdinal("content"));
               reviews.Add(item);
           }
           reader.Close();

           return reviews;
       }
        /// <summary>
        /// 窗体初始化
        /// </summary>
        public FormMailPartition()
        {
            InitializeComponent();
            wrapper = ModBusTCPIPWrapper.Instance();
            obrWrapper = new OBRClientWrapper();
            sqlHandler = SqlHelper.Instance();

            //委托实例化
            UpdateUIFunction = new receiveUpdateUI(UpdateUIAction);
            UpdateBarcodeFunction = new barcodeUpdateUI(UpdateBarcodeAction);
            UpdateTimerFunction = new UpdataTimer(UpdateTimerAction);
            UpdatePicFunction = new UpdatePic(UpdatePicAction);

            //PLC IP 文本框及状态更新
            this.textBoxPLCIP.Text = ConfigurationManager.AppSettings["PLCIP"];
            this.pictureBoxPLCConn.Image = Flag.BmpGray;
            //OBR IP 文本框及状态更新
            this.textBoxOBRIP.Text = ConfigurationManager.AppSettings["OBRIP"];
            this.pictureBoxOBRConn.Image = Flag.BmpGray;

            //连接状态更新计时器开启
            this.timerStatus.Start();

            //开启服务端监听即接收线程和客户端发送线程
            StartListenThread();
            StartConnectPLCThread();
            StartConnectOBRThread();

            //开启更新UI文本框线程
            UpdateUIThread();
        }
Ejemplo n.º 11
0
 public int DeleteTitleCss(int titleCssID)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     SqlParameter[] objParams = new SqlParameter[1];
     objParams[0] = new SqlParameter("@cssID", titleCssID);
     return objSqlHelper.ExecuteNonQuery("je_Tc_DeleteTitleCss", objParams);
 }
Ejemplo n.º 12
0
        public static string FindMaximumValue(int OperationValue)
        {
            string strMaxValue="";
            try
            {
                SqlHelper SH = new SqlHelper();
                SH.openconnection();

                SqlCommand cmdAuthors = new SqlCommand("sp_find_maximum", SH.conn);
                cmdAuthors.CommandType = CommandType.StoredProcedure;
                cmdAuthors.Parameters.Clear();

                cmdAuthors.Parameters.Add("@OutPutValue", SqlDbType.Int);
                cmdAuthors.Parameters["@OutPutValue"].Direction = ParameterDirection.Output;

                cmdAuthors.Parameters.Add("@Operation", SqlDbType.Int);
                cmdAuthors.Parameters["@Operation"].Value = OperationValue;

                cmdAuthors.ExecuteNonQuery();

                strMaxValue = cmdAuthors.Parameters["@OutPutValue"].Value.ToString();

                SH.closeconnection();
            }
            catch (Exception)
            {
                throw new System.NotImplementedException();
            }

            return strMaxValue;
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Создает новый учебный план.
        /// </summary>
        /// <param name="plan">Учебный план.</param>
        /// <returns>Идентификатор созданного учебного плана.</returns>
        public int Create(PlanItem plan)
        {
            using (var sqlh = new SqlHelper())
            {
                return sqlh.ExecScalar<int>(@"
            insert into TrainingPlan.specialty_plan
            (
            name,
            specialty_detail,
            semester,
            lesson_type,
            discipline,
            auditory
            )
            values
            (
            @Name,
            @SpecialtyDetail,
            @Semester,
            @LessonType,
            @Discipline,
            @Auditory
            )

            select scope_identity()", plan);
            }
        }
Ejemplo n.º 14
0
 public int DeleteSend(int SendID)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     SqlParameter[] objParams = new SqlParameter[1];
     objParams[0] = new SqlParameter("@sendID", SendID);
     return objSqlHelper.ExecuteNonQuery("je_Send_DeleteSend", objParams);
 }
Ejemplo n.º 15
0
        public static SqlCommand CreateCommand(string sql, CommandType type, List<SqlParameter> param)
        {
            //connectionstring();
            //SqlConnection con = new SqlConnection(strConnection);
            //con.Open();
            SqlHelper SH = new SqlHelper();
            SH.openconnection();

            SqlCommand cmd = new SqlCommand(sql,SH.conn);
            cmd.CommandType = CommandType.StoredProcedure;

            if (param.Count > 0)
            {
                foreach (SqlParameter p in param)
                {
                    if (p != null)
                    {
                        cmd.Parameters.Add(p);
                    }
                }
            }

            //sqlhelp.closeconnection();
            return cmd;
            SH.closeconnection();
        }
Ejemplo n.º 16
0
 public int DeleteCatena(int catenaID)
  {
      SqlHelper objSqlHelper = new SqlHelper();
      SqlParameter[] objParams = new SqlParameter[1];
      objParams[0] = new SqlParameter("@catenaID", catenaID);
      return objSqlHelper.ExecuteNonQuery("je_Ct_DeleteCatena", objParams);
  }
Ejemplo n.º 17
0
 public int DeleteHelp(int helpID)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     SqlParameter[] objParams = new SqlParameter[1];
     objParams[0] = new SqlParameter("@helpID", helpID);
   return objSqlHelper.ExecuteNonQuery("je_Help_DeleteHelp", objParams);
 }
Ejemplo n.º 18
0
 public int DeleteFavBookByID(int bookID)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     SqlParameter[] objParams = new SqlParameter[1];
     objParams[0] = new SqlParameter("@bookID", bookID);
     return objSqlHelper.ExecuteNonQuery("je_FBook_DeleteFavBooksByID", objParams);
 }
Ejemplo n.º 19
0
 public IList<ValoresFuente> Valores(Ciudad city, int limite, dynamic options = null)
 {
     var sql = string.Format("select {0} * ", limite == 0 ? "" : "top " + limite);
     sql += " from v_predio where id_ciudad = @id order by clave, num_construccion";
     var str = ConfigurationManager.ConnectionStrings["riesgos"].ConnectionString;
     var conn = new SqlConnection(str);
     conn.Open();
     var mapa = new Dictionary<string, ValoresFuente>();
     var reader = new SqlHelper(conn).ExecuteReader(sql, new { id = city.Id });
     while (reader.Read()) {
         var temp = new ValoresFuente();
         temp.Tipo = "construccion";
         Utils.FillDict(reader, temp);
         var cod = temp.GetString("clave");
         var num = temp.GetString("num_construccion") ?? "0";
         var key = Utils.MakeKey(cod, num);
         if (!mapa.ContainsKey(key)) {
             temp.Codigo1 = cod;
             temp.Codigo2 = num;
             temp.IdItem = temp["id"];
             mapa[key] = temp;
         }
         var cat = temp.GetString("clave_dato");
         if (!string.IsNullOrEmpty(cat))
             mapa[key][cat] = temp.GetString("valor_texto");
         temp.Remove("clave_dato");
         temp.Remove("valor_texto");
     }
     reader.Close();
     conn.Close();
     return mapa.Values.ToList();
 }
Ejemplo n.º 20
0
        public static SqlHelper Instance()
        {
            if (SqlHelper._instance == null)
                SqlHelper._instance = new SqlHelper();

            return SqlHelper._instance;
        }
Ejemplo n.º 21
0
 public int DeleteGuestBookByID(int gbID)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     SqlParameter[] objParams = new SqlParameter[1];
     objParams[0] = new SqlParameter("@gbID", gbID);
     return objSqlHelper.ExecuteNonQuery("je_Gb_DeleteGuestBookByID", objParams);
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Получает задачу по идентификатору.
 /// </summary>
 /// <param name="id">Идентификатор.</param>
 /// <returns>Задача.</returns>
 public TaskItem Get(int id)
 {
     using (var sqlh = new SqlHelper())
     {
         return sqlh.ExecMapping<TaskItem>(@"
     select
     t.task Id,
     t.number Number,
     p.code Prefix,
     t.header Header,
     t.mem Mem,
     t.created Created,
     t.deadline Deadline,
     t.priority Priority,
     t.performer Performer,
     t.author Author,
     t.is_perform IsPerform,
     t.is_open IsOpen,
     t.difficult Difficult,
     t.pull_request_url PullRequestUrl
     from Task.task t
     join Task.task_prefix p on p.task_prefix = t.task_prefix
     where t.task = @id", new { id });
     }
 }
        public string GetImpersonatedLoginFor(string login)
        {
            if (!_settings.IsImpersonationEnabled)
            {
                return null;
            }

            var sql = new SqlHelper("SELECT p.login_name, p.status FROM table_user u, table_user p WHERE u.login_name = {0} AND p.objid = u.user2proxy_user");
            sql.Parameters.Add("login", login);
            using (var result = sql.ExecuteReader())
            {
                while (result.Read())
                {
                    var status = Convert.ToInt32(result["status"]);
                    var impersonatedLoginFor = result["login_name"].ToString();

                    if (status == 1)
                    {
                        return impersonatedLoginFor;
                    }
                    else
                    {
                        _logger.LogDebug(
                            "Cancelling the impersonation of INACTIVE user {0} by user {1}.".ToFormat(impersonatedLoginFor,
                                login));
                        cancelImpersonation(login, impersonatedLoginFor);
                        return null;
                    }
                }

                return null;
            }
        }
Ejemplo n.º 24
0
    protected void InitData()
    {
        SqlHelper mydata = new SqlHelper();

        GridView1.DataSource = mydata.GetDataReader("select * from Musictype");
        GridView1.DataBind();
    }
 public static void createImpersonationFor(string impersonatingUserLogin, string userLoginBeingImpersonated)
 {
     var sql = new SqlHelper("update table_user set user2proxy_user = (select objid from table_user where login_name = {0}) where login_name = {1}");
     sql.Parameters.Add("login", userLoginBeingImpersonated);
     sql.Parameters.Add("proxylogin", impersonatingUserLogin);
     sql.ExecuteNonQuery();
 }
Ejemplo n.º 26
0
        public IList<FriendLinkInfo> GetLinks(LinkItemType linkType)
        {
            SqlHelper objSqlHelper = new SqlHelper();
            List<FriendLinkInfo> friendlinks = new List<FriendLinkInfo>();
            SqlParameter[] objParams = new SqlParameter[1];
            objParams[0] = new SqlParameter("@linkType", SqlDbType.Int, 4);
            objParams[0].Value = (int)linkType;
            SqlDataReader reader = objSqlHelper.ExecuteReader("je_Link_GetLinks", objParams); ;

            objParams[0].Value = (int)linkType;

            while (reader.Read())
            {
                FriendLinkInfo item = new FriendLinkInfo();
                item.LinkID = reader.GetInt32(reader.GetOrdinal("linkID"));
                item.LinkName = reader.GetString(reader.GetOrdinal("linkName"));
                item.LinkURL = reader.GetString(reader.GetOrdinal("linkURL"));
                item.LinkLogo = reader.GetString(reader.GetOrdinal("linkLogo"));
                item.LinkOrder = reader.GetInt32(reader.GetOrdinal("linkOrder"));
                item.IsMain = reader.GetBoolean(reader.GetOrdinal("linkMain"));
                item.IsArrow = reader.GetBoolean(reader.GetOrdinal("linkArrow"));
                friendlinks.Add(item);
            }
            reader.Close();
            return friendlinks;
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Создает новую аудиторию.
        /// </summary>
        /// <param name="auditory">Аудитория.</param>
        /// <returns>Идентификатор созданной аудитории.</returns>
        public int Create(AuditoryItem auditory)
        {
            using (var sqlh = new SqlHelper())
            {
                return sqlh.ExecScalar<int>(@"
            insert into Auditory.auditory
            (
            number,
            full_name,
            memo,
            level,
            capacity
            )
            values
            (
            @Number,
            @FullName,
            @Memo,
            @Level,
            @Capacity
            )

            select scope_identity()", auditory);
            }
        }
 public static void setAllowProxy(string userLogin, bool canProxy)
 {
     var sql = new SqlHelper("update table_employee set allow_proxy = {0} where objid = (select objid from table_user where login_name = {1})");
     sql.Parameters.Add("canProxy", canProxy ? 1 : 0);
     sql.Parameters.Add("login", userLogin);
     sql.ExecuteNonQuery();
 }
Ejemplo n.º 29
0
 public void Import()
 {
     var mySqlHelper = new MySqlHelper(MySql);
     var sqlHelper = new SqlHelper(SqlServer);
     var mysql = string.Format("select * from qdt_deal");
     var dt = mySqlHelper.ExecuteDataTable(mysql);
     var sql = "";
     var n = 0;
     for (var i = 0; i < dt.Rows.Count; i++)
     {
         sql += "INSERT INTO qdt_deal (id,name,sub_name,cate_id,user_id,description,is_effect,is_delete,borrow_amount,min_loan_money," +
                "repay_time,rate,create_time,update_time,is_recommend,buy_count,load_money,repay_money,start_time,success_time," +
                "repay_start_time,last_repay_time,next_repay_time,bad_time,deal_status,enddate,services_fee,is_send_bad_msg,bad_msg,loantype," +
                "warrant,titlecolor,is_send_contract,max_loan_money,icon,repay_time_type) " +
                "VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}','{30}','{31}','{32}','{33}','{34}','{35}');\r\n"
                .FormatWith(dt.Rows[i]["id"], dt.Rows[i]["name"], dt.Rows[i]["sub_name"], dt.Rows[i]["cate_id"], dt.Rows[i]["user_id"], dt.Rows[i]["description"].ToString().Replace('\'', '\"').Replace("./help/id-", "/Help/Index/").Replace("?", ""), dt.Rows[i]["is_effect"], dt.Rows[i]["is_delete"], dt.Rows[i]["borrow_amount"], dt.Rows[i]["min_loan_money"],
                dt.Rows[i]["repay_time"], dt.Rows[i]["rate"], GetTime(dt.Rows[i]["create_time"]), GetTime(dt.Rows[i]["update_time"]), dt.Rows[i]["is_recommend"], dt.Rows[i]["buy_count"], dt.Rows[i]["load_money"], dt.Rows[i]["repay_money"], GetTime(dt.Rows[i]["start_time"]), GetTime(dt.Rows[i]["success_time"]),
                GetTime(dt.Rows[i]["repay_start_time"]), GetTime(dt.Rows[i]["last_repay_time"]), GetTime(dt.Rows[i]["next_repay_time"]), GetTime(dt.Rows[i]["bad_time"]), dt.Rows[i]["deal_status"], dt.Rows[i]["enddate"], dt.Rows[i]["services_fee"], dt.Rows[i]["is_send_bad_msg"], dt.Rows[i]["bad_msg"], dt.Rows[i]["loantype"],
                dt.Rows[i]["warrant"], dt.Rows[i]["titlecolor"], dt.Rows[i]["is_send_contract"], dt.Rows[i]["max_loan_money"], dt.Rows[i]["icon"], dt.Rows[i]["repay_time_type"]).Replace("'NULL'","NULL");
         if ((i + 1) % 10 != 0) continue;
         n += sqlHelper.ExecuteNonQuery(sql);
         sql = "";
     }
     if (!string.IsNullOrWhiteSpace(sql))
     n += sqlHelper.ExecuteNonQuery(sql);
     Console.WriteLine("成功导入deal表:" + n + "条数据!");
 }
Ejemplo n.º 30
0
 public IList<ValoresFuente> Valores(Ciudad city, int limite, dynamic options = null)
 {
     var top = limite > 0 ? "top " + limite : "";
     var sql = "select " + top + " * from sta_elena order by codigo_catastral";
     var str = ConfigurationManager.ConnectionStrings["riesgos"].ConnectionString;
     var conn = new SqlConnection(str);
     conn.Open();
     var reader = new SqlHelper(conn).ExecuteReader(sql);
     var mapa = new Dictionary<string, ValoresFuente>();
     var i = 0;
     while (reader.Read()) {
         i++;
         var temp = new ValoresFuente();
         Utils.FillDict(reader, temp);
         var clave = temp.GetString("codigo_catastral");
         if (mapa.ContainsKey(clave))
             continue;
         var manzana = GetManzana(clave);
         temp.Tipo = "construccion";
         temp.Codigo1 = clave;
         temp.Codigo2 = manzana;
         temp.IdItem = i;
         temp["clave"] = clave;
         temp["manzana"] = manzana;
         mapa[clave] = temp;
     }
     reader.Close();
     conn.Close();
     return mapa.Values.ToList();
 }
Ejemplo n.º 31
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Hi.Model.DIS_GoodsStock model, SqlTransaction Tran)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [DIS_GoodsStock](");
            strSql.Append("[DisID],[CompID],[GoodsID],[IsSale],[GoodsInfo],[BatchNO],[validDate],[StockTotalNum],[StockUseNum],[StockNum],[MinAlertNum],[MaxAlertNum],[Price],[CreateUserID],[CreateDate],[ts],[modifyuser])");
            strSql.Append(" values (");
            strSql.Append("@DisID,@CompID,@GoodsID,@IsSale,@GoodsInfo,@BatchNO,@validDate,@StockTotalNum,@StockUseNum,@StockNum,@MinAlertNum,@MaxAlertNum,@Price,@CreateUserID,@CreateDate,@ts,@modifyuser)");
            strSql.Append(";select @@Identity");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DisID",         SqlDbType.Int),
                new SqlParameter("@CompID",        SqlDbType.Int),
                new SqlParameter("@GoodsID",       SqlDbType.BigInt),
                new SqlParameter("@IsSale",        SqlDbType.Int),
                new SqlParameter("@GoodsInfo",     SqlDbType.VarChar,   200),
                new SqlParameter("@BatchNO",       SqlDbType.VarChar,   100),
                new SqlParameter("@validDate",     SqlDbType.DateTime),
                new SqlParameter("@StockTotalNum", SqlDbType.Decimal),
                new SqlParameter("@StockUseNum",   SqlDbType.Decimal),
                new SqlParameter("@StockNum",      SqlDbType.Decimal),
                new SqlParameter("@MinAlertNum",   SqlDbType.Decimal),
                new SqlParameter("@MaxAlertNum",   SqlDbType.Decimal),
                new SqlParameter("@Price",         SqlDbType.Decimal),
                new SqlParameter("@CreateUserID",  SqlDbType.Int),
                new SqlParameter("@CreateDate",    SqlDbType.DateTime),
                new SqlParameter("@ts",            SqlDbType.DateTime),
                new SqlParameter("@modifyuser",    SqlDbType.Int)
            };
            parameters[0].Value = model.DisID;
            parameters[1].Value = model.CompID;
            parameters[2].Value = model.GoodsID;
            parameters[3].Value = model.IsSale;

            if (model.GoodsInfo != null)
            {
                parameters[4].Value = model.GoodsInfo;
            }
            else
            {
                parameters[4].Value = DBNull.Value;
            }


            if (model.BatchNO != null)
            {
                parameters[5].Value = model.BatchNO;
            }
            else
            {
                parameters[5].Value = DBNull.Value;
            }


            if (model.validDate != DateTime.MinValue)
            {
                parameters[6].Value = model.validDate;
            }
            else
            {
                parameters[6].Value = DBNull.Value;
            }

            parameters[7].Value  = model.StockTotalNum;
            parameters[8].Value  = model.StockUseNum;
            parameters[9].Value  = model.StockNum;
            parameters[10].Value = model.MinAlertNum;
            parameters[11].Value = model.MaxAlertNum;
            parameters[12].Value = model.Price;
            parameters[13].Value = model.CreateUserID;
            parameters[14].Value = model.CreateDate;
            parameters[15].Value = model.ts;
            parameters[16].Value = model.modifyuser;

            if (Tran != null)
            {
                return(SqlHelper.GetInt(SqlHelper.GetSingle(strSql.ToString(), Tran, parameters)));
            }
            return(SqlHelper.GetInt(SqlHelper.GetSingle(SqlHelper.LocalSqlServer, strSql.ToString(), parameters)));
        }
		/// <summary>
		/// Updates a TableColumnsUser into the data store based on the primitive properties. This can be used as the 
		/// update method for an ObjectDataSource.
		/// </summary>
		/// <param name="iD">iD</param>
		/// <param name="tableColumnID">tableColumnID</param>
		/// <param name="userID">userID</param>
		/// <param name="sortOrder">sortOrder</param>
		/// <param name="isShown">isShown</param>
		/// <param name="serviceStatus">serviceStatus</param>
		/// <param name="serviceType">serviceType</param>
		/// <param name="helper">helper</param>
		internal static void UpdateTableColumnsUser(int @iD, int @tableColumnID, int @userID, int @sortOrder, bool @isShown, int @serviceStatus, int @serviceType, SqlHelper @helper)
		{
			string commandText = @"
DECLARE @table TABLE(
	[ID] int,
	[TableColumnID] int,
	[UserID] int,
	[SortOrder] int,
	[IsShown] bit,
	[ServiceStatus] int,
	[ServiceType] int
);

UPDATE [dbo].[TableColumnsUser] SET 
	[TableColumnsUser].[TableColumnID] = @TableColumnID,
	[TableColumnsUser].[UserID] = @UserID,
	[TableColumnsUser].[SortOrder] = @SortOrder,
	[TableColumnsUser].[IsShown] = @IsShown,
	[TableColumnsUser].[ServiceStatus] = @ServiceStatus,
	[TableColumnsUser].[ServiceType] = @ServiceType 
output 
	INSERTED.[ID],
	INSERTED.[TableColumnID],
	INSERTED.[UserID],
	INSERTED.[SortOrder],
	INSERTED.[IsShown],
	INSERTED.[ServiceStatus],
	INSERTED.[ServiceType]
into @table
WHERE 
	[TableColumnsUser].[ID] = @ID

SELECT 
	[ID],
	[TableColumnID],
	[UserID],
	[SortOrder],
	[IsShown],
	[ServiceStatus],
	[ServiceType] 
FROM @table;
";
			
			System.Collections.Generic.List<SqlParameter> parameters = new System.Collections.Generic.List<SqlParameter>();
			parameters.Add(new SqlParameter("@ID", EntityBase.GetDatabaseValue(@iD)));
			parameters.Add(new SqlParameter("@TableColumnID", EntityBase.GetDatabaseValue(@tableColumnID)));
			parameters.Add(new SqlParameter("@UserID", EntityBase.GetDatabaseValue(@userID)));
			parameters.Add(new SqlParameter("@SortOrder", EntityBase.GetDatabaseValue(@sortOrder)));
			parameters.Add(new SqlParameter("@IsShown", @isShown));
			parameters.Add(new SqlParameter("@ServiceStatus", EntityBase.GetDatabaseValue(@serviceStatus)));
			parameters.Add(new SqlParameter("@ServiceType", EntityBase.GetDatabaseValue(@serviceType)));
			
			@helper.Execute(commandText, CommandType.Text, parameters);
		}
Ejemplo n.º 33
0
        /// <summary>
        /// 年休假设置信息添加
        /// </summary>
        /// <param name="YearHolidayM">YearHolidayM</param>
        /// <param name="StrYearHoliday">年休假设置信息</param>
        /// <returns>添加是否成功 false:失败,true:成功</returns>
        public static string  AddYearHolidayInfoSet(YearHolidayModel YearHolidayM, string StrYearHoliday)
        {
            string[] strarray    = null;
            string   recorditems = "";

            string[] inseritems = null;
            string   ErrMsg     = "";

            try
            {
                strarray = StrYearHoliday.Split('|');
                for (int i = 0; i < strarray.Length; i++)
                {
                    StringBuilder StrYearHolidaySql = new StringBuilder();
                    recorditems = strarray[i];
                    inseritems  = recorditems.Split(',');
                    if (recorditems.Length != 0)
                    {
                        string EmployeeID   = inseritems[0].ToString().Trim(); //员工ID
                        string HolidayHours = inseritems[1].ToString().Trim(); //时长
                        string UserName     = inseritems[2].ToString().Trim(); //姓名
                        if (YearHolidayIsExist(EmployeeID) == 0)               //插入
                        {
                            #region 添加SQL
                            StrYearHolidaySql.AppendLine("INSERT INTO officedba.YearHoliday");
                            StrYearHolidaySql.AppendLine("		(CompanyCD      ");
                            StrYearHolidaySql.AppendLine("		,EmployeeID        ");
                            StrYearHolidaySql.AppendLine("		,HolidayHours        ");
                            StrYearHolidaySql.AppendLine("		,ModifiedDate        ");
                            StrYearHolidaySql.AppendLine("		,ModifiedUserID)        ");
                            StrYearHolidaySql.AppendLine("VALUES                  ");
                            StrYearHolidaySql.AppendLine("		('"+ YearHolidayM.CompanyCD + "'     ");
                            StrYearHolidaySql.AppendLine("		,"+ Convert.ToInt32(EmployeeID) + "       ");
                            StrYearHolidaySql.AppendLine("		,"+ Convert.ToDecimal(HolidayHours) + "       ");
                            StrYearHolidaySql.AppendLine("		,'"+ YearHolidayM.ModifiedDate + "'       ");
                            StrYearHolidaySql.AppendLine("		,'"+ YearHolidayM.ModifiedUserID + "')       ");
                            #endregion
                        }
                        else//更新
                        {
                            #region 更新SQL
                            StrYearHolidaySql.AppendLine("UPDATE officedba.YearHoliday");
                            StrYearHolidaySql.AppendLine("	SET	CompanyCD='"+ YearHolidayM.CompanyCD + "'      ");
                            StrYearHolidaySql.AppendLine("		,HolidayHours="+ Convert.ToDecimal(HolidayHours) + "        ");
                            StrYearHolidaySql.AppendLine("		,ModifiedDate='"+ YearHolidayM.ModifiedDate + "'        ");
                            StrYearHolidaySql.AppendLine("		,ModifiedUserID='"+ YearHolidayM.ModifiedUserID + "'      ");
                            StrYearHolidaySql.AppendLine("		WHERE EmployeeID="+ Convert.ToInt32(EmployeeID) + "      ");
                            #endregion
                        }
                        SqlHelper.ExecuteTransSql(StrYearHolidaySql.ToString());
                        if (SqlHelper.Result.OprateCount <= 0)
                        {
                            ErrMsg = UserName + ',';
                        }
                    }
                }
                return(ErrMsg);
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
Ejemplo n.º 34
0
        /// <summary>
        /// 获取人员
        /// </summary>
        /// <returns>DataTable</returns>
        public static DataTable GetUserList()
        {
            string sql = "select a.ID,a.EmployeeName from officedba.EmployeeInfo a ";

            return(SqlHelper.ExecuteSql(sql));
        }
Ejemplo n.º 35
0
 public DataTable GetResource(string typeId, int pageSize, int pageIndex)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@pageSize", pageSize), new SqlParameter("@pageIndex", pageIndex), new SqlParameter("@ResourceTypeId", typeId) };
     return(SqlHelper.ExecuteQuery(CommandType.StoredProcedure, "cpResource", commandParameters));
 }
Ejemplo n.º 36
0
        public int GetCount()
        {
            string str = "SELECT COUNT(1) FROM Res_Resource";

            return(DBHelper.GetInt(SqlHelper.ExecuteScalar(CommandType.Text, str.ToString(), new SqlParameter[0])));
        }
Ejemplo n.º 37
0
        public DataTable GetAllResource()
        {
            string cmdText = "SELECT * FROM Res_Resource ";

            return(SqlHelper.ExecuteQuery(CommandType.Text, cmdText, new SqlParameter[0]));
        }
        /// <summary>
        /// 任务调度平台根据发布的任务时间配置,定时回调运行方法
        /// 开发人员的任务插件必须要重载并该方法
        /// </summary>
        public override void Run()
        {
            runcount++;

            ConfigHelper.LoadConfig(this.AppConfig["BusinessMQManageConnectString"]);

            List <tb_partition_model>           userdpartitions          = new List <tb_partition_model>();
            Dictionary <int, tb_datanode_model> datanodemodels           = new Dictionary <int, tb_datanode_model>();
            List <RegisterdConsumersModel>      registeredconsumermodels = new List <RegisterdConsumersModel>();
            List <tb_consumer_model>            consumers = new List <tb_consumer_model>();
            DateTime servertime = DateTime.Now;

            SqlHelper.ExcuteSql(this.AppConfig["BusinessMQManageConnectString"], (c) =>
            {
                tb_partition_dal partitiondal = new tb_partition_dal();
                userdpartitions             = partitiondal.List(c, true);
                tb_datanode_dal datanodedal = new tb_datanode_dal();
                var ms = datanodedal.List(c);
                foreach (var m in ms)
                {
                    datanodemodels.Add(m.datanodepartition, m);
                }
                servertime = c.GetServerDate();

                //获取当前注册的消费者
                tb_consumer_dal consumerdal = new tb_consumer_dal();
                registeredconsumermodels    = consumerdal.GetRegisterdConsumers(c);
                consumers = consumerdal.GetAllList(c);
            });
            //消费者端心跳停止,异常退出检测(超过1分钟)
            List <Exception> exps = new List <Exception>();

            foreach (var c in consumers)
            {
                if ((servertime - c.lastheartbeat) > TimeSpan.FromMinutes(1))
                {
                    exps.Add(new Exception(string.Format("当前消费者tempid:{0},consumerclientid:{1}", c.tempid, c.consumerclientid)));
                }
            }
            Error(this.AppConfig["BusinessMQManageConnectString"], "消费者端心跳停止,异常退出检测(超过1分钟),若是异常停止,请手工清除消费者中断", exps);
            //消费者端长时间无消费,但是还有多余消息(超过10分钟未消费,但还有多余消息未消费)
            exps.Clear();
            foreach (var c in registeredconsumermodels)
            {
                if ((servertime - c.consumerpartitionmodel.lastupdatetime) > TimeSpan.FromMinutes(10))
                {
                    var partitionidinfo = XXF.BaseService.MessageQuque.BusinessMQ.SystemRuntime.PartitionRuleHelper.GetPartitionIDInfo(c.consumerpartitionmodel.partitionid);
                    var tablename       = XXF.BaseService.MessageQuque.BusinessMQ.SystemRuntime.PartitionRuleHelper.GetTableName(partitionidinfo.TablePartition, servertime.Date);
                    SqlHelper.ExcuteSql(this.GetDataNodeConnectString(datanodemodels[partitionidinfo.DataNodePartition]), (conn) =>
                    {
                        tb_messagequeue_dal messagedal = new tb_messagequeue_dal(); messagedal.TableName = tablename;
                        long maxmqid = messagedal.GetMaxID(conn);
                        if (maxmqid > c.consumerpartitionmodel.lastmqid && (servertime - messagedal.GetIDCreateTime(conn, maxmqid).Value > TimeSpan.FromMinutes(10)))//还有消息未消费,且该消息的创建时间是10分钟前
                        {
                            exps.Add(new Exception(string.Format("当前消费者tempid:{0},consumerclientid:{1},client:{2},clientname:{3}", c.consumermodel.tempid,
                                                                 c.consumermodel.consumerclientid, c.consumerclientmodel.client, c.consumermodel.clientname)));
                        }
                    });
                }
            }
            Error(this.AppConfig["BusinessMQManageConnectString"], "消费者端长时间无消费,但是还有多余消息(超过已创建超过10分钟的消息未消费),可能是消费者处理逻辑异常", exps);
            //某个分区没有指定消费者(分区没有消费信息,或者分区消费最后消费时间超过1个小时无消费)
            exps.Clear();
            if (runcount % (12 * 6) == 0)
            {
                foreach (var u in userdpartitions)
                {
                    bool isfind = false;
                    foreach (var c in registeredconsumermodels)
                    {
                        if (c.consumerpartitionmodel.partitionid == u.partitionid)
                        {
                            isfind = true; break;
                        }
                    }
                    if (isfind == false)
                    {
                        SqlHelper.ExcuteSql(this.AppConfig["BusinessMQManageConnectString"], (c) =>
                        {
                            tb_consumer_partition_dal dal = new tb_consumer_partition_dal();
                            var model = dal.GetByPartitionId(c, u.partitionid);
                            if (model == null)
                            {
                                exps.Add(new Exception(string.Format("分区{0}未指定消费者", u.partitionid)));
                            }
                            //else if((servertime - model.lastupdatetime) > TimeSpan.FromHours(24))
                            //     exps.Add(new Exception(string.Format("分区{0}消费者已注销,且有1天未消费", u.partitionid)));
                        });
                    }
                }
                Error(this.AppConfig["BusinessMQManageConnectString"], "某个分区没有指定消费者(分区没有消费信息)", exps);
            }
        }
Ejemplo n.º 39
0
 public static StyleSheet GetByName(string name)
 {
     try
     {
         int id = SqlHelper.ExecuteScalar <int>("SELECT id FROM umbracoNode WHERE text = @text AND nodeObjectType = @objType ", SqlHelper.CreateParameter("@text", name), SqlHelper.CreateParameter("@objType", StyleSheet.ModuleObjectType));
         return(new StyleSheet(id));
     }
     catch
     {
         return(null);
     }
 }
Ejemplo n.º 40
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hi.Model.DIS_GoodsStock model, SqlTransaction Tran)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [DIS_GoodsStock] set ");
            strSql.Append("[DisID]=@DisID,");
            strSql.Append("[CompID]=@CompID,");
            strSql.Append("[GoodsID]=@GoodsID,");
            strSql.Append("[IsSale]=@IsSale,");
            strSql.Append("[GoodsInfo]=@GoodsInfo,");
            strSql.Append("[BatchNO]=@BatchNO,");
            strSql.Append("[validDate]=@validDate,");
            strSql.Append("[StockTotalNum]=@StockTotalNum,");
            strSql.Append("[StockUseNum]=@StockUseNum,");
            strSql.Append("[StockNum]=@StockNum,");
            strSql.Append("[MinAlertNum]=@MinAlertNum,");
            strSql.Append("[MaxAlertNum]=@MaxAlertNum,");
            strSql.Append("[Price]=@Price,");
            strSql.Append("[CreateUserID]=@CreateUserID,");
            strSql.Append("[CreateDate]=@CreateDate,");
            strSql.Append("[ts]=@ts,");
            strSql.Append("[dr]=@dr,");
            strSql.Append("[modifyuser]=@modifyuser");
            strSql.Append(" where [ID]=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",            SqlDbType.BigInt),
                new SqlParameter("@DisID",         SqlDbType.Int),
                new SqlParameter("@CompID",        SqlDbType.Int),
                new SqlParameter("@GoodsID",       SqlDbType.BigInt),
                new SqlParameter("@IsSale",        SqlDbType.Int),
                new SqlParameter("@GoodsInfo",     SqlDbType.VarChar,   200),
                new SqlParameter("@BatchNO",       SqlDbType.VarChar,   100),
                new SqlParameter("@validDate",     SqlDbType.DateTime),
                new SqlParameter("@StockTotalNum", SqlDbType.Decimal),
                new SqlParameter("@StockUseNum",   SqlDbType.Decimal),
                new SqlParameter("@StockNum",      SqlDbType.Decimal),
                new SqlParameter("@MinAlertNum",   SqlDbType.Decimal),
                new SqlParameter("@MaxAlertNum",   SqlDbType.Decimal),
                new SqlParameter("@Price",         SqlDbType.Decimal),
                new SqlParameter("@CreateUserID",  SqlDbType.Int),
                new SqlParameter("@CreateDate",    SqlDbType.DateTime),
                new SqlParameter("@ts",            SqlDbType.DateTime),
                new SqlParameter("@dr",            SqlDbType.SmallInt),
                new SqlParameter("@modifyuser",    SqlDbType.Int)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.DisID;
            parameters[2].Value = model.CompID;
            parameters[3].Value = model.GoodsID;
            parameters[4].Value = model.IsSale;

            if (model.GoodsInfo != null)
            {
                parameters[5].Value = model.GoodsInfo;
            }
            else
            {
                parameters[5].Value = DBNull.Value;
            }


            if (model.BatchNO != null)
            {
                parameters[6].Value = model.BatchNO;
            }
            else
            {
                parameters[6].Value = DBNull.Value;
            }


            if (model.validDate != DateTime.MinValue)
            {
                parameters[7].Value = model.validDate;
            }
            else
            {
                parameters[7].Value = DBNull.Value;
            }

            parameters[8].Value  = model.StockTotalNum;
            parameters[9].Value  = model.StockUseNum;
            parameters[10].Value = model.StockNum;
            parameters[11].Value = model.MinAlertNum;
            parameters[12].Value = model.MaxAlertNum;
            parameters[13].Value = model.Price;
            parameters[14].Value = model.CreateUserID;
            parameters[15].Value = model.CreateDate;
            parameters[16].Value = model.ts;
            parameters[17].Value = model.dr;
            parameters[18].Value = model.modifyuser;

            if (Tran != null)
            {
                return(SqlHelper.ExecuteSql(strSql.ToString(), Tran, parameters) > 0);
            }
            return(SqlHelper.ExecuteSql(SqlHelper.LocalSqlServer, strSql.ToString(), parameters) > 0);
        }
Ejemplo n.º 41
0
        public static StyleSheet MakeNew(BusinessLogic.User user, string Text, string FileName, string Content)
        {
            // Create the umbraco node
            var newNode = CMSNode.MakeNew(-1, ModuleObjectType, user.Id, 1, Text, Guid.NewGuid());

            // Create the stylesheet data
            SqlHelper.ExecuteNonQuery(string.Format("insert into cmsStylesheet (nodeId, filename, content) values ('{0}','{1}',@content)", newNode.Id, FileName), SqlHelper.CreateParameter("@content", Content));

            // save to file to avoid file coherency issues
            var newCss = new StyleSheet(newNode.Id, false, false);
            var e      = new NewEventArgs();

            newCss.OnNew(e);

            return(newCss);
        }
Ejemplo n.º 42
0
        //绑定数据
        public void GridViewBind()
        {
            SqlDataReader datar = SqlHelper.ExecuteReader("select a.*,b.mc,c.bm_mc,d.hys_mc from oa_hyqc a left outer JOIN hk_ZDYLX b on (a.hylx=b.id) left outer JOIN BM c on (a.zkbm=c.bm_id) left outer join oa_hys d on (a.zkdd=d.hys_id) where a.id='" + hkdb.GetStr(Request.QueryString["id"].ToString()) + "' and a.zt='送审中'");

            if (datar.Read())
            {
                hyzt.Text = datar["hyzt"].ToString();
                hylx.Text = datar["mc"].ToString();
                kssj.Text = datar["kssj"].ToString();
                jssj.Text = datar["jssj"].ToString();
                zkbm.Text = datar["bm_mc"].ToString();
                zkdd.Text = datar["hys_mc"].ToString();
                cxfw.Text = datar["cxfw"].ToString();
                //将人员编码转化为名称
                cjry.Text          = (SqlHelper.ExecuteScalar("exec sp_IdToName '" + datar["cjry"] + "','1'") == System.DBNull.Value ? "" : (string)(SqlHelper.ExecuteScalar("exec sp_IdToName '" + datar["cjry"] + "','1'")));
                fzr.Text           = datar["zcr"].ToString();
                jysm.Text          = datar["jysm"].ToString();
                savefj.Text        = datar["hyzl"].ToString();
                savefj.NavigateUrl = (datar["path"] == System.DBNull.Value ? "" : "../.." + datar["path"].ToString()) + datar["hyzl"].ToString();
                vsdate.Text        = datar["kssj"].ToString();
                vedate.Text        = datar["jssj"].ToString();
                ycxx.Text          = datar["fqr"].ToString();
                ycdd.Text          = datar["zkdd"].ToString();
                datar.Close();
            }
            else
            {
                datar.Close();
                mydb.Alert_Close("此会议已审批完成!");
            }
            if (!string.IsNullOrEmpty(savefj.Text))
            {
                savefj.Text = "下载会议资料";
            }
        }
        public static bool DeleteBusinessKeywordsConfig(int id)
        {
            const string sql = @"DELETE FROM Configuration.dbo.BusinessKeywordsConfig WHERE Id=@Id";

            return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, new SqlParameter("@Id", id)) > 0);
        }
Ejemplo n.º 44
0
        public override void delete()
        {
            var e = new DeleteEventArgs();

            FireBeforeDelete(e);

            if (!e.Cancel)
            {
                File.Delete(IOHelper.MapPath(String.Format("{0}/{1}.css", SystemDirectories.Css, this.Text)));
                foreach (var p in Properties.Where(p => p != null))
                {
                    p.delete();
                }
                SqlHelper.ExecuteNonQuery("delete from cmsStylesheet where nodeId = @nodeId", SqlHelper.CreateParameter("@nodeId", this.Id));
                base.delete();

                FireAfterDelete(e);
            }
        }
Ejemplo n.º 45
0
        public static bool ConcelConfirm(string ID, string FromType, string OrderNo, List<ProductModel> ProductMList, List<ProductModel> ProductMStorList, out string Reason)
        {
            try
            {
                Reason = string.Empty;
                //不可以确认返回false
                if (!PurchaseOrderDBHelper.CanConcel(ID, out Reason))
                    return false;
                ArrayList lstConcelConfirm = new ArrayList();
                //更新主表
                SqlCommand ConcelPri = PurchaseOrderDBHelper.ConcelConfirm(ID);
                lstConcelConfirm.Add(ConcelPri);

                //更新分仓存量表
                if (ProductMStorList != null)
                {
                    foreach (ProductModel ProductM in ProductMStorList)
                    {
                        SqlCommand comm = PurchaseOrderDBHelper.WriteStorgeDecr(ProductM);
                        lstConcelConfirm.Add(comm);
                    }
                }
                if (ProductMList != null)
                {
                    if (FromType == "2")
                    {//回写采购计划
                        foreach (ProductModel ProductM in ProductMList)
                        {
                            SqlCommand comm = PurchaseOrderDBHelper.WritePurPlanDecr(ProductM);
                            lstConcelConfirm.Add(comm);
                        }
                    }
                    else if (FromType == "4")
                    {//回写采购合同
                        foreach (ProductModel ProductM in ProductMList)
                        {
                            SqlCommand comm = PurchaseOrderDBHelper.WritePurContDecr(ProductM);
                            lstConcelConfirm.Add(comm);
                        }
                    }
                }
                //获取登陆用户信息
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

                //撤销审批
                string CompanyCD = userInfo.CompanyCD;
                string BillTypeFlag = ConstUtil.CODING_RULE_PURCHASE;
                string BillTypeCode = ConstUtil.CODING_RULE_PURCHASE_ORDER;
                string strUserID = userInfo.UserID; ;
                DataTable dt = FlowDBHelper.GetFlowInstanceInfo(CompanyCD, Convert.ToInt32(BillTypeFlag), Convert.ToInt32(BillTypeCode), Convert.ToInt32(ID));
                if (dt.Rows.Count > 0)
                {
                    string FlowInstanceID = dt.Rows[0]["FlowInstanceID"].ToString();
                    string FlowStatus = dt.Rows[0]["FlowStatus"].ToString();
                    string FlowNo = dt.Rows[0]["FlowNo"].ToString();

                    lstConcelConfirm.Add(FlowDBHelper.CancelConfirmHis(CompanyCD, FlowInstanceID, FlowNo, BillTypeFlag, BillTypeCode, strUserID));
                    lstConcelConfirm.Add(FlowDBHelper.CancelConfirmTsk(CompanyCD, FlowInstanceID, strUserID));
                    lstConcelConfirm.Add(FlowDBHelper.CancelConfirmIns(CompanyCD, FlowNo, BillTypeFlag, BillTypeCode, ID, strUserID));
                }

                //定义返回变量
                bool isSucc = false;
                /* 
                 * 定义日志内容变量 
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

                //执行插入操作
                try
                {
                    isSucc = SqlHelper.ExecuteTransWithArrayList(lstConcelConfirm);
                }
                catch (Exception ex)
                {
                    //输出日志
                    WriteSystemLog(userInfo, ex);
                }
                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识 
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }

                LogInfoModel logModel = InitLogInfo(OrderNo);
                //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
                logModel.Element = ConstUtil.LOG_PROCESS_UNCONFIRM;
                //设置操作成功标识
                logModel.Remark = remark;

                //登陆日志
                LogDBHelper.InsertLog(logModel);
                return isSucc;
            }
            catch (Exception ex)
            {
                throw ex;
            }



        }
Ejemplo n.º 46
0
        public ViewResult Index(string txtCode, string txtName, string txtCardCode, int?CardTypeId, string txtPhone, string txtLicensePlates, string txtOption)
        {
            var q = CustomerRepository.GetAllvwCustomer().Where(x => x.BranchId == Helpers.Common.CurrentUser.BranchId);

            if (!string.IsNullOrEmpty(txtCardCode))
            {
                q = q.Where(x => x.CardCode == txtCardCode);
            }
            if (!string.IsNullOrEmpty(txtCode))
            {
                q = q.Where(x => x.Code.Contains(txtCode));
            }

            if (!string.IsNullOrEmpty(txtName))
            {
                q = q.Where(x => x.Name.Contains(txtName));
            }

            if (!string.IsNullOrEmpty(txtPhone))
            {
                q = q.Where(x => x.Phone.Contains(txtPhone));
            }

            //if (CardTypeId != null)
            //{
            //    q = q.Where(x => x.MemberCardTypeId == CardTypeId);
            //}

            if (!string.IsNullOrEmpty(txtLicensePlates))
            {
                q = SqlHelper.QuerySP <vwCustomer>("spSale_GetCustomerByPlate", new { Plate = txtLicensePlates }).AsQueryable();
            }

            if (!string.IsNullOrEmpty(txtOption))
            {
                bool check = txtOption == "YES" ? true: false;
                if (check)
                {
                    q = q.Where(x => x.MemberCardId != null);
                }
                else
                {
                    q = q.Where(x => x.MemberCardId == null);
                }
            }

            IQueryable <CustomerViewModel> model = q.Select(item => new CustomerViewModel
            {
                Id                    = item.Id,
                CreatedUserId         = item.CreatedUserId,
                CreatedDate           = item.CreatedDate,
                ModifiedUserId        = item.ModifiedUserId,
                ModifiedDate          = item.ModifiedDate,
                Code                  = item.Code,
                Name                  = item.Name,
                Phone                 = item.Phone,
                Address               = item.Address,
                WardName              = item.WardName,
                ProvinceName          = item.ProvinceName,
                DistrictName          = item.DistrictName,
                Point                 = item.Point,
                MemberCardTypeName    = item.MemberCardTypeName,
                CardCode              = item.CardCode,
                EndDateProductInvoice = item.EndDateProductInvoice
            }).OrderByDescending(m => m.ModifiedDate);

            ViewBag.SuccessMessage = TempData["SuccessMessage"];
            ViewBag.FailedMessage  = TempData["FailedMessage"];
            ViewBag.AlertMessage   = TempData["AlertMessage"];
            return(View(model));
        }
Ejemplo n.º 47
0
        public static bool DeletePurchaseOrder(string IDs, string OrderNos)
        {
            try
            {
                ArrayList lstDelete = new ArrayList();
                SqlCommand DelPri = PurchaseOrderDBHelper.DeletePurchaseOrder(IDs);
                lstDelete.Add(DelPri);
                SqlCommand DelDtl = PurchaseOrderDBHelper.DeletePurchaseOrderDetail(OrderNos);
                lstDelete.Add(DelDtl);

                //获取登陆用户信息
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
                //定义返回变量
                bool isSucc = false;
                /* 
                 * 定义日志内容变量 
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

                //执行删除操作
                try
                {
                    isSucc = SqlHelper.ExecuteTransWithArrayList(lstDelete);
                }
                catch (Exception ex)
                {
                    //输出日志
                    WriteSystemLog(userInfo, ex);
                }


                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识 
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }

                //获取删除的编号列表
                string[] noList = OrderNos.Split(',');
                //遍历所有编号,登陆操作日志
                for (int i = 0; i < noList.Length; i++)
                {
                    //获取编号
                    string no = noList[i];
                    //替换两边的 '
                    no = no.Replace("'", string.Empty);

                    //操作日志
                    LogInfoModel logModel = InitLogInfo(no);
                    //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
                    logModel.Element = ConstUtil.LOG_PROCESS_DELETE;
                    //设置操作成功标识
                    logModel.Remark = remark;

                    //登陆日志
                    LogDBHelper.InsertLog(logModel);
                }
                return isSucc;

            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Ejemplo n.º 48
0
    static void Main()
    {
        var connectionString = @"Data Source=.\SqlExpress;Initial Catalog=nservicebus;Integrated Security=True;Max Pool Size=100;Min Pool Size=10";

        Console.Title = "Samples.ServiceControl.SqlServerTransportAdapter.Shipping";
        var endpointConfiguration = new BusConfiguration();

        endpointConfiguration.EndpointName("Samples.ServiceControl.SqlServerTransportAdapter.Shipping");

        var transport = endpointConfiguration.UseTransport <SqlServerTransport>();

        transport.ConnectionString(connectionString);

        SqlHelper.EnsureDatabaseExists(connectionString);
        SqlHelper.CreateSchema(connectionString, "shipping");
        SqlHelper.CreateSchema(connectionString, "adapter");

        #region ShippingSchema

        //Use custom schema shipping for this endpoint
        transport.DefaultSchema("shipping");

        transport.UseSpecificConnectionInformation(
            //Configure schema for sales endpoint so that the subscribe message is sent to the correct address
            EndpointConnectionInfo.For("Samples.ServiceControl.SqlServerTransportAdapter.Sales").UseSchema("sales"),
            //Configure schemas for ServiceControl queues to point to the adapter
            EndpointConnectionInfo.For("audit").UseSchema("adapter"),
            EndpointConnectionInfo.For("error").UseSchema("adapter"),
            EndpointConnectionInfo.For("Particular.ServiceControl").UseSchema("adapter")
            );

        #endregion

        endpointConfiguration.UsePersistence <InMemoryPersistence>();

        var chaos = new ChaosGenerator();
        endpointConfiguration.RegisterComponents(
            registration: components =>
        {
            components.ConfigureComponent(() => chaos, DependencyLifecycle.SingleInstance);
        });

        endpointConfiguration.DisableFeature <SecondLevelRetries>();

        var conventions = endpointConfiguration.Conventions();
        conventions.DefiningEventsAs(t => t == typeof(OrderAccepted) || t == typeof(OrderShipped));

        endpointConfiguration.SendHeartbeatTo("Particular.ServiceControl");
        endpointConfiguration.EnableInstallers();

        using (var endpointInstance = Bus.Create(endpointConfiguration).Start())
        {
            Console.WriteLine("Press enter to exit");
            Console.WriteLine("Press 'f' to toggle simulating of message processing failure");
            while (true)
            {
                var key = Console.ReadKey();
                Console.WriteLine();
                if (key.Key == ConsoleKey.Enter)
                {
                    break;
                }
                var lowerInvariant = char.ToLowerInvariant(key.KeyChar);
                if (lowerInvariant == 'f')
                {
                    chaos.IsFailing = !chaos.IsFailing;
                    Console.WriteLine($"Failure simulation is now turned {(chaos.IsFailing ? "on" : "off")}");
                }
            }
        }
    }
Ejemplo n.º 49
0
        public static bool InsertPurchaseOrder(PurchaseOrderModel PurchaseOrderM, List<PurchaseOrderDetailModel> PurchaseOrderDetailMList, out int IndexIDentity, out string Reason, Hashtable htExtAttr)
        {
            try
            {
                IndexIDentity = 0;
                //判断引用源单数量有没有超过,超过了就不让保存
                if (!PurchaseOrderDBHelper.CanSave(PurchaseOrderDetailMList, out Reason))
                    return false;
                ArrayList lstAdd = new ArrayList();
                //插入主表
                SqlCommand AddPri = PurchaseOrderDBHelper.InsertPurchaseOrder(PurchaseOrderM);
                lstAdd.Add(AddPri);
                string OrderNo = PurchaseOrderM.OrderNo;
                //插入明细
                foreach (PurchaseOrderDetailModel PurchaseOrderDetailM in PurchaseOrderDetailMList)
                {
                    SqlCommand AddDetail = PurchaseOrderDBHelper.InsertPurchaseOrderDetail(PurchaseOrderDetailM, OrderNo);
                    lstAdd.Add(AddDetail);
                }
                #region 拓展属性
                SqlCommand cmd = new SqlCommand();
                GetExtAttrCmd(PurchaseOrderM, htExtAttr, cmd);
                if (htExtAttr.Count > 0)
                    lstAdd.Add(cmd);
                #endregion
                //获取登陆用户信息
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
                //定义返回变量
                bool isSucc = false;
                /* 
                 * 定义日志内容变量 
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

                //执行插入操作
                try
                {
                    isSucc = SqlHelper.ExecuteTransWithArrayList(lstAdd);
                }
                catch (Exception ex)
                {
                    //输出日志
                    WriteSystemLog(userInfo, ex);
                }


                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                    IndexIDentity = int.Parse(((SqlCommand)AddPri).Parameters["@IndexID"].Value.ToString());
                }
                else
                {
                    //设置操作成功标识 
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                    IndexIDentity = 0;
                }

                LogInfoModel logModel = InitLogInfo(OrderNo);
                //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
                logModel.Element = ConstUtil.LOG_PROCESS_INSERT;
                //设置操作成功标识
                logModel.Remark = remark;

                //登陆日志
                LogDBHelper.InsertLog(logModel);
                return isSucc;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 50
0
        public static bool ConfirmPuechaseOrder(string CompanyCD, string ID, string FromType, string OrderNo, out string Reason, List<ProductModel> ProductMList, List<ProductModel> ProductMStorList)
        {
            try
            {

                if (!PurchaseOrderDBHelper.CanConfirm(CompanyCD, OrderNo, int.Parse(ID), FromType, out Reason))
                    return false;
                ArrayList lstConfirm = new ArrayList();
                //写确认人,确认时间,单据状态
                lstConfirm.Add(PurchaseOrderDBHelper.ConfirmPurchaseOrder(ID));
                //回写合同表
                if (FromType == "4")
                {
                    foreach (ProductModel ProductM in ProductMList)
                    {
                        lstConfirm.Add(PurchaseOrderDBHelper.WritePurContract(ProductM));
                    }
                }
                else if (FromType == "2")
                {//回写计划表
                    foreach (ProductModel ProductM in ProductMList)
                    {
                        lstConfirm.Add(PurchaseOrderDBHelper.WritePurPlanConfirm(ProductM));
                    }
                }
                //回写库存分仓存量表
                foreach (ProductModel ProductM in ProductMStorList)
                {
                    lstConfirm.Add(PurchaseOrderDBHelper.WriteStorge(ProductM));
                }

                //获取登陆用户信息
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
                //定义返回变量
                bool isSucc = false;
                /* 
                 * 定义日志内容变量 
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

                //执行插入操作
                try
                {
                    isSucc = SqlHelper.ExecuteTransWithArrayList(lstConfirm);
                }
                catch (Exception ex)
                {
                    //输出日志
                    WriteSystemLog(userInfo, ex);
                }
                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识 
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }

                LogInfoModel logModel = InitLogInfo(OrderNo);
                //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
                logModel.Element = ConstUtil.LOG_PROCESS_CONFIRM;
                //设置操作成功标识
                logModel.Remark = remark;

                //登陆日志
                LogDBHelper.InsertLog(logModel);
                return isSucc;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 51
0
 public override IDataReader Email_GetAll()
 {
     return(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("Email_GetAll")));
 }
Ejemplo n.º 52
0
        /// <summary>
        /// 更新采购订单
        /// </summary>
        /// <param name="PurchaseOrderM">主表model</param>
        /// <param name="PurchaseOrderDetailMList">明细表modellist</param>
        /// <param name="ProductMStorList">用于回写库存的物品modellist</param>
        /// <param name="ProductMList">用于回写计划或是合同的物品modellist</param>
        /// <returns>DataTable</returns>
        public static bool UpdatePurchaseOrder(PurchaseOrderModel PurchaseOrderM, List<PurchaseOrderDetailModel> PurchaseOrderDetailMList
            , List<ProductModel> ProductMStorList, List<ProductModel> ProductMList, out string Reason, Hashtable htExtAttr)
        {
            try
            {
                //判断引用源单数量有没有超过,超过了就不让保存
                if (!PurchaseOrderDBHelper.CanSave(PurchaseOrderDetailMList, out Reason))
                    return false;
                //判断该单据有没有确认


                //判断该单据是不是可以确认,包括引用的源单数量是不是合法,有没有到达库存报警上限



                ArrayList lstUpdate = new ArrayList();

                //更新主表
                SqlCommand UpdatePri = PurchaseOrderDBHelper.UpdatePurchaseOrder(PurchaseOrderM);
                lstUpdate.Add(UpdatePri);
                #region 拓展属性
                SqlCommand cmd = new SqlCommand();
                GetExtAttrCmd(PurchaseOrderM, htExtAttr, cmd);
                if (htExtAttr.Count > 0)
                    lstUpdate.Add(cmd);
                #endregion

                string OrderNo = PurchaseOrderM.OrderNo;
                //删除明细
                SqlCommand DeleteDetail = PurchaseOrderDBHelper.DeletePurchaseOrderDetailSingle(OrderNo);
                lstUpdate.Add(DeleteDetail);

                //插入明细
                foreach (PurchaseOrderDetailModel PurchaseOrderDetailM in PurchaseOrderDetailMList)
                {
                    SqlCommand AddDetail = PurchaseOrderDBHelper.InsertPurchaseOrderDetail(PurchaseOrderDetailM, OrderNo);
                    lstUpdate.Add(AddDetail);
                }
                //获取登陆用户信息
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
                //定义返回变量
                bool isSucc = false;
                /* 
                 * 定义日志内容变量 
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

                //执行插入操作
                try
                {
                    isSucc = SqlHelper.ExecuteTransWithArrayList(lstUpdate);
                }
                catch (Exception ex)
                {
                    //输出日志
                    WriteSystemLog(userInfo, ex);
                }
                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识 
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }

                LogInfoModel logModel = InitLogInfo(OrderNo);
                //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
                logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;
                //设置操作成功标识
                logModel.Remark = remark;

                //登陆日志
                LogDBHelper.InsertLog(logModel);
                return isSucc;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 53
0
 public override IDataReader GetEmailTemplateId(int EmailTemplateId)
 {
     return(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetEmailTemplate"), EmailTemplateId));
 }
Ejemplo n.º 54
0
		/// <summary>
		/// Persists the object.
		/// </summary>
		public virtual void Persist(CitizenshipResidencyType persistObject, SqlTransaction sqlTrans)
		{
			// create local variable array for the sql parameters
			SqlParameterHash sqlparams = null;
			// Create a local variable for the connection
			SqlConnection cnn = null;


			// Use the parameter overload or create a new instance
			if (sqlTrans == null)
				cnn = new SqlConnection(CitizenshipResidencyType.GetConnectionString());


			try
			{
				// discover the parameters
				if (persistObject.Persisted)
					sqlparams =  SqlHelperParameterCache.GetSpParameterSet(CitizenshipResidencyType.GetConnectionString(), "gsp_UpdateCitizenshipResidencyType");
				else
					sqlparams =  SqlHelperParameterCache.GetSpParameterSet(CitizenshipResidencyType.GetConnectionString(), "gsp_CreateCitizenshipResidencyType");


				// Store the parameter for the Name attribute.
				sqlparams["@name"].Value = persistObject.Name;
				// Store the parameter for the EnumeratedName attribute.
				sqlparams["@enumeratedName"].Value = persistObject.EnumeratedName;
				// Store the parameter for the Description attribute.
				if (!persistObject.DescriptionIsNull)
					sqlparams["@description"].Value = persistObject.Description;
				// Store the parameter for the Id attribute.
				sqlparams["@id"].Value = persistObject.Id;
				if (!persistObject.Persisted)
				{
					// store the create only (historical fixed) values
				}
				else
				{
					// store the update only (historical changeable) values
				}


				if (sqlTrans == null)
				{
					// Process using the isolated connection
					using (cnn)
					{
						// open the connection
						cnn.Open();


						if (!persistObject.Persisted)
						{
							SqlHelper.ExecuteNonQuery(cnn, CommandType.StoredProcedure, "gsp_CreateCitizenshipResidencyType", sqlparams);
						}
						else
						{
							SqlHelper.ExecuteNonQuery(cnn, CommandType.StoredProcedure, "gsp_UpdateCitizenshipResidencyType", sqlparams);
						}


						// close the connection after usage
						cnn.Close();
					}


					// nullify the connection var
					cnn = null;
				}
				else
				{
					// Process using the shared transaction
					if (!persistObject.Persisted)
					{
						SqlHelper.ExecuteNonQuery(sqlTrans, CommandType.StoredProcedure, "gsp_CreateCitizenshipResidencyType", sqlparams);
					}
					else
					{
						SqlHelper.ExecuteNonQuery(sqlTrans, CommandType.StoredProcedure, "gsp_UpdateCitizenshipResidencyType", sqlparams);
					}
				}
			}
			catch (SqlException sqlex)
			{
				throw sqlex;
			}
		}
Ejemplo n.º 55
0
 public override void EmailTemplate_Update(int Id, string subject, int typeEmail, string content)
 {
     SqlHelper.ExecuteScalar(ConnectionString, GetFullyQualifiedName("EmailTemplate_Update"), Id, subject, typeEmail, content);
 }
Ejemplo n.º 56
0
 public override IDataReader GetEmailInfo(int Id)
 {
     return(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetEmailInfo"), Id));
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Obtiene un registro de la tabla T304_SUBNODO,
        /// y devuelve una instancia u objeto del tipo SUBNODO
        /// </summary>
        /// <returns></returns>
        /// <history>
        ///     Creado por [sqladmin]	10/06/2008 12:52:13
        /// </history>
        /// -----------------------------------------------------------------------------
        public static SUBNODO Select(SqlTransaction tr, int t304_idsubnodo)
        {
            SUBNODO o = new SUBNODO();

            SqlParameter[] aParam = new SqlParameter[1];
            aParam[0]       = new SqlParameter("@t304_idsubnodo", SqlDbType.Int, 4);
            aParam[0].Value = t304_idsubnodo;

            SqlDataReader dr;

            if (tr == null)
            {
                dr = SqlHelper.ExecuteSqlDataReader("SUP_SUBNODO_S", aParam);
            }
            else
            {
                dr = SqlHelper.ExecuteSqlDataReaderTransaccion(tr, "SUP_SUBNODO_S", aParam);
            }

            if (dr.Read())
            {
                if (dr["t304_idsubnodo"] != DBNull.Value)
                {
                    o.t304_idsubnodo = int.Parse(dr["t304_idsubnodo"].ToString());
                }
                if (dr["t304_denominacion"] != DBNull.Value)
                {
                    o.t304_denominacion = (string)dr["t304_denominacion"];
                }
                if (dr["t303_idnodo"] != DBNull.Value)
                {
                    o.t303_idnodo = int.Parse(dr["t303_idnodo"].ToString());
                }
                if (dr["t304_orden"] != DBNull.Value)
                {
                    o.t304_orden = int.Parse(dr["t304_orden"].ToString());
                }
                if (dr["t304_estado"] != DBNull.Value)
                {
                    o.t304_estado = (bool)dr["t304_estado"];
                }
                if (dr["t304_maniobra"] != DBNull.Value)
                {
                    o.t304_maniobra = byte.Parse(dr["t304_maniobra"].ToString());
                }
                if (dr["t314_idusuario_responsable"] != DBNull.Value)
                {
                    o.t314_idusuario_responsable = int.Parse(dr["t314_idusuario_responsable"].ToString());
                }
                if (dr["t313_idempresa"] != DBNull.Value)
                {
                    o.t313_idempresa = int.Parse(dr["t313_idempresa"].ToString());
                }
                if (dr["t313_denominacion"] != DBNull.Value)
                {
                    o.t313_denominacion = (string)dr["t313_denominacion"];
                }
            }
            else
            {
                throw (new NullReferenceException("No se ha obtenido ningun dato de SUBNODO"));
            }

            dr.Close();
            dr.Dispose();

            return(o);
        }
Ejemplo n.º 58
0
 public override IDataReader EmailTemplate_Filter(int pageIndex, int pageSize)
 {
     return(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("EmailTemplate_GetAll"), pageIndex, pageSize));
 }
Ejemplo n.º 59
0
 //proceso de estado
 public static DataTable DtoListarEstado()
 {
     return(SqlHelper.ExecuteDataTable(conexion, "Listar_Estado"));
 }
Ejemplo n.º 60
0
        public override void Visit(SqlFunctionCall node)
        {
            switch (node.FunctionType)
            {
            case SqlFunctionType.PadLeft:
            case SqlFunctionType.PadRight:
                SqlHelper.GenericPad(node).AcceptVisitor(this);
                return;

            case SqlFunctionType.DateTimeOffsetAddYears:
            case SqlFunctionType.DateTimeAddYears:
                DateTimeAddComponent(node.Arguments[0], node.Arguments[1], true).AcceptVisitor(this);
                return;

            case SqlFunctionType.DateTimeOffsetAddMonths:
            case SqlFunctionType.DateTimeAddMonths:
                DateTimeAddComponent(node.Arguments[0], node.Arguments[1], false).AcceptVisitor(this);
                return;

            case SqlFunctionType.IntervalConstruct:
                IntervalConstruct(node.Arguments[0]).AcceptVisitor(this);
                return;

            case SqlFunctionType.DateTimeConstruct:
                DateTimeConstruct(node.Arguments[0], node.Arguments[1], node.Arguments[2]).AcceptVisitor(this);
                return;

            case SqlFunctionType.IntervalAbs:
                SqlHelper.IntervalAbs(node.Arguments[0]).AcceptVisitor(this);
                return;

            case SqlFunctionType.IntervalToMilliseconds:
                SqlHelper.IntervalToMilliseconds(node.Arguments[0]).AcceptVisitor(this);
                return;

            case SqlFunctionType.IntervalToNanoseconds:
                SqlHelper.IntervalToNanoseconds(node.Arguments[0]).AcceptVisitor(this);
                return;

            case SqlFunctionType.Position:
                Position(node.Arguments[0], node.Arguments[1]).AcceptVisitor(this);
                return;

            case SqlFunctionType.CharLength:
                SqlDml.Coalesce(SqlDml.FunctionCall("LENGTH", node.Arguments[0]), 0).AcceptVisitor(this);
                return;

            case SqlFunctionType.DateTimeToStringIso:
                DateTimeToStringIso(node.Arguments[0]).AcceptVisitor(this);
                return;

            case SqlFunctionType.DateTimeOffsetConstruct:
                DateTimeOffsetConstruct(node.Arguments[0], node.Arguments[1]).AcceptVisitor(this);
                return;

            case SqlFunctionType.DateTimeOffsetTimeOfDay:
                DateTimeOffsetTimeOfDay(node.Arguments[0]).AcceptVisitor(this);
                return;

            case SqlFunctionType.DateTimeOffsetToLocalTime:
                DateTimeOffsetToLocalTime(node.Arguments[0]).AcceptVisitor(this);
                return;

            case SqlFunctionType.DateTimeToDateTimeOffset:
                DateTimeToDateTimeOffset(node.Arguments[0]).AcceptVisitor(this);
                return;

            case SqlFunctionType.DateTimeOffsetToUtcTime:
                DateTimeOffsetToUtcTime(node.Arguments[0]).AcceptVisitor(this);
                return;

            default:
                base.Visit(node);
                return;
            }
        }