Пример #1
0
    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDelete_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {
        string attrNameId = ViewState["attrNameId"].ToString();
        string attrValId  = this.dgAttrVal.SelectedItem.Cells[0].Text;

        if (attrValId != "")
        {
            Hi.Model.BD_DefDoc_B attrValModel = AttrValBLL.GetModel(Convert.ToInt16(attrValId));

            if (attrValModel != null)
            {
                bool falg = AttrValBLL.Delete(Convert.ToInt16(attrValId));
                if (falg)
                {
                    JScript.AlertMsgOne(this, "数据删除成功!", JScript.IconOption.错误, 2500);
                    AttrValBind(attrNameId, 1);
                    Clear();

                    //日志
                    //Hi.Model.A_AdminUser UModel = Session["AdminUser"] as Hi.Model.A_AdminUser;
                    //Utils.EditLog("用户" + this.UserName + "删除属性值成功", ID, "属性名称模块", "SysManager/AttrManager.aspx", 1);
                }
            }
            else
            {
                JScript.AlertMsgOne(this, "数据不存在!", JScript.IconOption.错误, 2500);
            }
        }
    }
Пример #2
0
    /// <summary>
    /// 计量单位验证
    /// </summary>
    /// <param name="value"></param>
    /// <param name="str"></param>
    /// <param name="index"></param>
    /// <param name="Tran"></param>
    /// <returns></returns>
    public string CheckGoodsUnit(string value, string str, SqlTransaction Tran)
    {
        List <Hi.Model.BD_DefDoc_B> l = new Hi.BLL.BD_DefDoc_B().GetList("", " AtVal = '" + value.Trim() + "' and AtName='计量单位' and compid=" + this.CompID + " and isnull(dr,0)=0", "", Tran);

        if (l.Count == 0)
        {
            List <Hi.Model.BD_DefDoc> list = new Hi.BLL.BD_DefDoc().GetList("", " AtName='计量单位' and compid=" + this.CompID + " and isnull(dr,0)=0", "", Tran);
            int defid = 0;
            if (list.Count == 0)
            {
                Hi.Model.BD_DefDoc doc = new Hi.Model.BD_DefDoc();
                doc.CompID     = this.CompID;
                doc.AtCode     = "";
                doc.AtName     = "计量单位";
                doc.ts         = DateTime.Now;
                doc.modifyuser = this.UserID;
                doc.dr         = 0;
                defid          = new Hi.BLL.BD_DefDoc().Add(doc, Tran);
            }
            else
            {
                defid = list[0].ID;
            }
            Hi.Model.BD_DefDoc_B item = new Hi.Model.BD_DefDoc_B();
            item.AtVal      = value;
            item.AtName     = "计量单位";
            item.CompID     = this.CompID;
            item.DefID      = defid;
            item.ts         = DateTime.Now;
            item.dr         = 0;
            item.modifyuser = this.UserID;
            int count = new Hi.BLL.BD_DefDoc_B().Add(item, Tran);
            //if (count == 0)
            //{
            //    JScript.AlertMethod(this, "Excel没有数据,请重新导入", JScript.IconOption.错误, "function(){location.href='ImportGoods.aspx'}");
            //    throw new ApplicationException("Excel行号为:&nbsp;<i error>" + (index + TitleIndex + 1) + "</i> &nbsp;&nbsp;的数据有误。" + str + "录入数据库失败,请修改后重新导入。");
            //}
        }
        return(value);
    }
Пример #3
0
    /// <summary>
    /// 修改字典项信息
    /// </summary>
    /// <param name="AttrValId"></param>
    protected void updateAttrVal(string AttrValId)
    {
        if (AttrValId != "")
        {
            Hi.Model.BD_DefDoc_B attrValModel = AttrValBLL.GetModel(Convert.ToInt32(AttrValId));
            if (attrValModel != null)
            {
                ViewState["attrValId"] = AttrValId;

                this.txtAtVal.Text     = attrValModel.AtVal;
                this.txtSortIndex.Text = attrValModel.SortIndex.ToString();

                //项目扩展
                this.btnUp.Visible     = false;
                this.btnDown.Visible   = false;
                this.btnAddNew.Visible = false;

                this.btnSave.Visible   = true;
                this.btnDelete.Visible = true;

                //this.table.Visible = true;
                this.val.Visible          = true;
                this.Sorh.Visible         = true;
                this.txtAtVal.Visible     = true;
                this.txtSortIndex.Visible = true;


                this.lblMsg.Visible     = false;
                this.lblAttrValMsg.Text = "";
            }
            else
            {
                JScript.AlertMsgOne(this, "数据不存在!", JScript.IconOption.错误, 2500);
            }
        }
    }
Пример #4
0
    /// <summary>
    /// 保存按钮
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {
        string attrVal   = string.Empty; //属性值
        string SortIndex = string.Empty; //排序
        string str       = string.Empty;

        string attrNameId = ViewState["attrNameId"].ToString();  //属性名称Id
        string attrValId  = ViewState["attrValId"].ToString();   //属性值Id

        #region 获取页面的值
        if (this.txtAtVal.Text != "")
        {
            attrVal = this.txtAtVal.Text.Trim();
        }
        if (this.txtSortIndex.Text != "")
        {
            SortIndex = this.txtSortIndex.Text.Trim();
        }
        #endregion

        #region  判断
        if (attrVal == "")
        {
            str += "- 属性值不能为空。\\r\\n";
        }
        //if (SortIndex == "")
        //{
        //    str += "- 排序不能为空。\\r\\n";
        //}
        #endregion

        if (str != "")
        {
            JScript.AlertMsgOne(this, str, JScript.IconOption.错误, 2500);
            return;
        }

        Hi.Model.BD_DefDoc_B attrValModel  = new Hi.Model.BD_DefDoc_B();
        Hi.Model.BD_DefDoc   AttrNameModel = AttrNameBLL.GetModel(Convert.ToInt16(attrNameId));
        if (AttrNameModel != null)
        {
            attrValModel.ID        = Convert.ToInt16(attrValId);
            attrValModel.DefID     = Convert.ToInt16(attrNameId);
            attrValModel.AtName    = AttrNameModel.AtName;
            attrValModel.AtVal     = attrVal;
            attrValModel.SortIndex = SortIndex;

            bool falg = AttrValBLL.Update(attrValModel);
            if (falg)
            {
                JScript.AlertMsgOne(this, "数据修改成功!", JScript.IconOption.笑脸);
                AttrValBind(attrNameId, 1);
                Clear();

                //日志
                // Hi.Model.A_AdminUser UModel = Session["AdminUser"] as Hi.Model.A_AdminUser;
                //Utils.EditLog("用户" + this.UserName + "修改属性值成功", ID, "属性名称模块", "SysManager/AttrManager.aspx", 1);
            }
            else
            {
                JScript.AlertMsgOne(this, "数据修改失败", JScript.IconOption.错误, 2500);
            }
        }
        else
        {
            JScript.AlertMsgOne(this, "属性名称不存在", JScript.IconOption.错误, 2500);
        }
    }
Пример #5
0
    /// <summary>
    /// 添加费用科目
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected string AddFykm(string unit)
    {
        SqlTransaction Tran = null;

        try
        {
            Tran = DBUtility.SqlHelper.CreateStoreTranSaction();
            //新增数据字典
            Hi.Model.BD_DefDoc doc = new Hi.Model.BD_DefDoc();
            doc.CompID     = this.CompID;
            doc.AtCode     = "";
            doc.AtName     = "费用科目";
            doc.ts         = DateTime.Now;
            doc.modifyuser = UserID;
            doc.dr         = 0;
            List <Hi.Model.BD_DefDoc> ll = new Hi.BLL.BD_DefDoc().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and atname='费用科目'", "");
            int defid = 0;
            if (ll.Count == 0)
            {
                defid = new Hi.BLL.BD_DefDoc().Add(doc, Tran);
            }
            else
            {
                defid = ll[0].ID;
            }
            if (defid != 0)
            {
                Hi.Model.BD_DefDoc_B doc2 = new Hi.Model.BD_DefDoc_B();
                doc2.CompID     = this.CompID;
                doc2.DefID      = defid;
                doc2.AtName     = "费用科目";
                doc2.AtVal      = unit; //txtunits.Value.Trim();
                doc2.ts         = DateTime.Now;
                doc2.dr         = 0;
                doc2.modifyuser = this.UserID;
                List <Hi.Model.BD_DefDoc_B> lll = new Hi.BLL.BD_DefDoc_B().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and atname='费用科目' and defid=" + defid + " and atval='" + unit + "'", "");
                if (lll.Count == 0)
                {
                    new Hi.BLL.BD_DefDoc_B().Add(doc2, Tran);
                }
                else
                {
                    return("[{\"AtVal\":\"ycz\"}]");
                }
            }
            Tran.Commit();
            List <Hi.Model.BD_DefDoc> l = new Hi.BLL.BD_DefDoc().GetList("", "AtName='费用科目' and compid=" + this.CompID + " and isnull(dr,0)=0", "");
            if (l.Count > 0)
            {
                List <Hi.Model.BD_DefDoc_B> llll = new Hi.BLL.BD_DefDoc_B().GetList("", "DefID=" + l[0].ID + "and ISNULL(dr,0)=0 and compid=" + this.CompID, "id desc");
                if (llll.Count > 0)
                {
                    DataTable dt = Common.FillDataTable(llll);
                    if (dt.Rows.Count != 0)
                    {
                        return(ConvertJson.ToJson(dt));
                    }
                }
            }
            return("[{\"AtVal\":\"cc\"}]");
            // this.txtunit.Value = unit;
        }
        catch (Exception)
        {
            if (Tran != null)
            {
                if (Tran.Connection != null)
                {
                    Tran.Rollback();
                }
            }
            return("[{\"AtVal\":\"sb\"}]");
        }
        finally
        {
            DBUtility.SqlHelper.ConnectionClose();
        }
    }
Пример #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hi.Model.BD_DefDoc_B model)
 {
     return(dal.Update(model));
 }
Пример #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Hi.Model.BD_DefDoc_B model)
 {
     return(dal.Add(model));
 }