예제 #1
0
        private string AddCode(string ItemCode, string MainGuid, int isAutoGenCode)
        {
            string   itemGuid  = Guid.NewGuid().ToString();
            string   str2      = "";
            string   itemCode  = "";
            bool     canSelect = false;
            DataView view      = this.CodeItem.SelectNextOneLevel(MainGuid, ItemCode, out canSelect);

            if (view.Count == 0)
            {
                if (isAutoGenCode == 1)
                {
                    itemCode = ItemCode + "1".PadLeft(4, '0');
                }
                else
                {
                    DataView view2 = new DB_Frame_Code_Level().Select(MainGuid);
                    view2.RowFilter = "CurrentLevalBit>" + ItemCode.Length.ToString();
                    view2.Sort      = " CurrentLevalBit asc ";
                    int num = 0;
                    if (view2.Count > 0)
                    {
                        num = Convert.ToInt32(view2[0]["CurrentLevalBit"]);
                    }
                    else
                    {
                        return("当前添加的代码级数未在代码级数中定义,请先定义代码级数!");
                    }
                    itemCode = ItemCode + "1".PadLeft(num - ItemCode.Length, '0');
                }
                this.CodeItem.Insert(itemGuid, MainGuid, this.txtItemText.Text, this.txtItemValue.Text, itemCode, this.txtPinYinJc.Text, Functions.IntNull(this.txtOrderNumber.Text));
                DB_Frame_OperationLog.Insert(DB_Frame_OperationLog.LOG_OPERATOR_TYPE_ADD, DB_Frame_OperationLog.LOG_SUBSYSTEM_TYPE_Frame, this.Session["UserGuid"].ToString(), this.Session["DisplayName"].ToString(), "添加代码项。代码类型名称:" + this.ViewState["CodeName"].ToString() + ";代码类别Guid:" + this.ViewState["MainGuid"].ToString() + ";代码项名称:" + this.txtItemText.Text + ";代码值名称:" + this.txtItemValue.Text + ";代码项ItemGuid:" + itemGuid, "", this.Session["BaseOUGuid"].ToString());
                return(str2);
            }
            view.Sort = "ItemCode desc";
            string str4 = view[0]["ItemCode"].ToString();
            string str5 = str4.Substring(ItemCode.Length);

            itemCode = ItemCode + Convert.ToString((int)(Convert.ToInt32(str5) + 1)).PadLeft(str5.Length, '0');
            if (itemCode.Length > str4.Length)
            {
                return("当前代码级数的位数已经超过定义的代码级数,请先重新定义代码级数!");
            }
            this.CodeItem.Insert(itemGuid, MainGuid, this.txtItemText.Text, this.txtItemValue.Text, itemCode, this.txtPinYinJc.Text, Functions.IntNull(this.txtOrderNumber.Text));
            DB_Frame_OperationLog.Insert(DB_Frame_OperationLog.LOG_OPERATOR_TYPE_ADD, DB_Frame_OperationLog.LOG_SUBSYSTEM_TYPE_Frame, this.Session["UserGuid"].ToString(), this.Session["DisplayName"].ToString(), "添加代码项。代码类型名称:" + this.ViewState["CodeName"].ToString() + ";代码类别Guid:" + this.ViewState["MainGuid"].ToString() + ";代码项名称:" + this.txtItemText.Text + ";代码值名称:" + this.txtItemValue.Text + ";代码项ItemGuid:" + itemGuid, "", this.Session["BaseOUGuid"].ToString());
            return(str2);
        }
예제 #2
0
 private string AddCode(string ItemCode, string MainGuid, int isAutoGenCode)
 {
     string itemGuid = Guid.NewGuid().ToString();
     string str2 = "";
     string itemCode = "";
     bool canSelect = false;
     DataView view = this.CodeItem.SelectNextOneLevel(MainGuid, ItemCode, out canSelect);
     if (view.Count == 0)
     {
         if (isAutoGenCode == 1)
         {
             itemCode = ItemCode + "1".PadLeft(4, '0');
         }
         else
         {
             DataView view2 = new DB_Frame_Code_Level().Select(MainGuid);
             view2.RowFilter = "CurrentLevalBit>" + ItemCode.Length.ToString();
             view2.Sort = " CurrentLevalBit asc ";
             int num = 0;
             if (view2.Count > 0)
             {
                 num = Convert.ToInt32(view2[0]["CurrentLevalBit"]);
             }
             else
             {
                 return "��ǰ��ӵĴ��뼶��δ�ڴ��뼶���ж��壬���ȶ�����뼶����";
             }
             itemCode = ItemCode + "1".PadLeft(num - ItemCode.Length, '0');
         }
         this.CodeItem.Insert(itemGuid, MainGuid, this.txtItemText.Text, this.txtItemValue.Text, itemCode, this.txtPinYinJc.Text, Functions.IntNull(this.txtOrderNumber.Text));
         DB_Frame_OperationLog.Insert(DB_Frame_OperationLog.LOG_OPERATOR_TYPE_ADD, DB_Frame_OperationLog.LOG_SUBSYSTEM_TYPE_Frame, this.Session["UserGuid"].ToString(), this.Session["DisplayName"].ToString(), "��Ӵ���������������ƣ�" + this.ViewState["CodeName"].ToString() + "���������Guid��" + this.ViewState["MainGuid"].ToString() + "�����������ƣ�" + this.txtItemText.Text + "������ֵ���ƣ�" + this.txtItemValue.Text + "��������ItemGuid��" + itemGuid, "", this.Session["BaseOUGuid"].ToString());
         return str2;
     }
     view.Sort = "ItemCode desc";
     string str4 = view[0]["ItemCode"].ToString();
     string str5 = str4.Substring(ItemCode.Length);
     itemCode = ItemCode + Convert.ToString((int)(Convert.ToInt32(str5) + 1)).PadLeft(str5.Length, '0');
     if (itemCode.Length > str4.Length)
     {
         return "��ǰ���뼶����λ���Ѿ���������Ĵ��뼶�����������¶�����뼶����";
     }
     this.CodeItem.Insert(itemGuid, MainGuid, this.txtItemText.Text, this.txtItemValue.Text, itemCode, this.txtPinYinJc.Text, Functions.IntNull(this.txtOrderNumber.Text));
     DB_Frame_OperationLog.Insert(DB_Frame_OperationLog.LOG_OPERATOR_TYPE_ADD, DB_Frame_OperationLog.LOG_SUBSYSTEM_TYPE_Frame, this.Session["UserGuid"].ToString(), this.Session["DisplayName"].ToString(), "��Ӵ���������������ƣ�" + this.ViewState["CodeName"].ToString() + "���������Guid��" + this.ViewState["MainGuid"].ToString() + "�����������ƣ�" + this.txtItemText.Text + "������ֵ���ƣ�" + this.txtItemValue.Text + "��������ItemGuid��" + itemGuid, "", this.Session["BaseOUGuid"].ToString());
     return str2;
 }