Beispiel #1
0
        /// <summary>根据商品分类id返回商品分类名称</summary>
        /// <param name="alldt">商品分类表</param>
        /// <param name="ptype1">商品分类1</param>
        /// <param name="ptype2">商品分类2</param>
        /// <param name="ptype3">商品分类3</param>
        /// <returns>根据商品分类id返回商品分类名称</returns>
        public static string GetProductType(DataTable alldt, string ptype1, string ptype2, string ptype3)
        {
            string title1 = "";
            string title2 = "";
            string title3 = "";

            if (Often.IsInt64(ptype1))
            {
                DataRow[] pdr1 = alldt.Select("id=" + ptype1);
                if (pdr1.Length > 0)
                {
                    title1 = pdr1[0]["title"].ToString().Trim();
                }
            }
            if (Often.IsInt64(ptype2))
            {
                DataRow[] pdr2 = alldt.Select("id=" + ptype2);
                if (pdr2.Length > 0)
                {
                    title2 = pdr2[0]["title"].ToString().Trim();
                }
            }
            if (Often.IsInt64(ptype3))
            {
                DataRow[] pdr3 = alldt.Select("id=" + ptype3);
                if (pdr3.Length > 0)
                {
                    title3 = pdr3[0]["title"].ToString().Trim();
                }
            }
            return(title1 + "﹥" + title2 + "﹥" + title3);
        }
Beispiel #2
0
 /// <summary>如果输入的字符串不是长整数则返回默认字符串值</summary>
 /// <param name="str">输入的字符串</param>
 /// <param name="defstr">默认字符串值</param>
 /// <returns>如果输入的字符串不是长整数则返回默认字符串值</returns>
 public static string GetInt64(string str, string defstr)
 {
     if (!Often.IsInt64(str))
     {
         return(defstr);
     }
     return(str);
 }
Beispiel #3
0
        private void bt05b_Click(object sender, EventArgs e)
        {
            string s = GetInput();

            if (!Often.IsInt64(s))
            {
                WinOften.MessShow("输入的字符串必须是整数", 1);
                return;
            }
            GetOut(Often.DecToIp(Convert.ToInt64(GetInput())).ToString());
        }
Beispiel #4
0
 /// <summary>如果输入的字符串不是长整数则返回默认字符串值</summary>
 /// <param name="str">输入的字符串</param>
 /// <param name="defstr">默认字符串值</param>
 /// <returns>如果输入的字符串不是长整数则返回默认字符串值</returns>
 public static string GetInt64(string str, string defstr)
 {
     if (Often.IsNum(str))
     {
         double d = Convert.ToDouble(str);
         if (Often.IsInt64(d))
         {
             return(Convert.ToInt64(d).ToString());
         }
     }
     return(defstr);
 }
Beispiel #5
0
 /// <summary>添加id到不重复id集合</summary>
 /// <param name="ids">需要添加的id</param>
 /// <param name="idlist">id列表引用</param>
 /// <param name="idstr">id集合引用</param>
 public static void AddIDs(string ids, ref List <long> idlist, ref StringBuilder idstr)
 {
     if (Often.IsInt64(ids))
     {
         long lid = Convert.ToInt64(ids);
         if (lid > 0 && idlist.IndexOf(lid) == -1)
         {
             if (idstr.Length > 0)
             {
                 idstr.Append(",");
             }
             idstr.Append(lid.ToString());
             idlist.Add(lid);
         }
     }
 }
Beispiel #6
0
        private void btbuild_Click(object sender, EventArgs e)
        {
            StringBuilder sb    = new StringBuilder();
            string        urlq  = tburlq.Text.Trim();
            string        urlh  = tburlh.Text.Trim();
            string        snums = tbnums.Text.Trim();
            string        snume = tbnume.Text.Trim();

            if (!Often.IsInt64(snums))
            {
                WinOften.MessShow("循环起始数字必须是整数!", 1);
                return;
            }
            if (!Often.IsInt64(snume))
            {
                WinOften.MessShow("循环终止数字必须是整数!", 1);
                return;
            }
            long nums = Convert.ToInt64(snums);
            long nume = Convert.ToInt64(snume);

            if (nume < nums)
            {
                WinOften.MessShow("循环终止数字不能小于循环起始数字!", 1);
                return;
            }
            for (long i = nums; i <= nume; i++)
            {
                if (sb.Length > 0)
                {
                    sb.Append("\r\n");
                }
                sb.Append(urlq + i.ToString() + urlh);
            }
            IsOper          = true;
            rTBUrlList.Text = sb.ToString();
            RegRuleText     = rTBUrlList.Text.Trim();
        }
Beispiel #7
0
        /// <summary>从选中的行建立新的表并返回</summary>
        /// <param name="alldt">指定内存表</param>
        /// <param name="pids">选中id集合</param>
        /// <returns>从选中的行建立新的表并返回</returns>
        public static DataTable GetSelectTable(DataTable alldt, string pids)
        {
            DataTable seldt = alldt.Clone();

            seldt.Clear();
            if (pids.Trim() != "")
            {
                string[] arrids = pids.Split(',');
                for (int i = 0; i < arrids.Length; i++)
                {
                    string sid = arrids[i];
                    if (Often.IsInt64(sid))
                    {
                        DataRow[] dr = alldt.Select("id=" + sid);
                        if (dr.Length > 0)
                        {
                            seldt.ImportRow(dr[0]);
                        }
                    }
                }
            }
            return(seldt);
        }