예제 #1
0
        /// <summary>
        /// 判断审批意见是否已存在
        /// </summary>
        /// <param name="appGuid">申请单Guid</param>
        /// <returns></returns>
        public bool IsOpinionExist(string appGuid)
        {
            Hashtable ht = new Hashtable();
            ht.Add("AppGuid", appGuid);

            Model.Accredit model = new Model.Accredit();

            return model.IsExist(ht);
        }
예제 #2
0
        /// <summary>
        /// 更新申请单状态
        /// </summary>
        private void EditState()
        {
            string guid = Request.Params["applyGuid"];
            string applyState = AppState.SelectedValue;
            _appState = Request.Params["applyState"];
            appPage = Request.Params["appPage"];
            Model.Application apply = new Model.Application();
            Model.Accredit accredit = new Model.Accredit();

            Hashtable ht = new Hashtable();
            ht.Add("Guid", guid);
            Model.Application appli = Model.Application.Instance.GetModelById(ht);
            Model.SCW scw = new Model.SCW();
            if (appli.IO == 1)
            {
                Model.PrintNum printNum = new Model.PrintNum();
                using (DataTable dt = CNVP.Framework.DataAccess.DataFactory.GetInstance().ExecuteTable("select max(ApplyNum) as maxA from CNVP_PrintNum"))
                {
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        int maxANum = Convert.ToInt32(dt.Rows[0]["maxA"].ToString()) + 1;
                        printNum.Update("ApplyNum=" + maxANum, string.Empty);
                        apply.Update("PrintNum=" + maxANum, " and Guid='" +
                    guid + "'");
                    }
                }
                using (DataTable dt1 = CNVP.Framework.DataAccess.DataFactory.GetInstance().ExecuteTable("select max(ScwNum) as maxS from CNVP_PrintNum"))
                {
                    if (dt1 != null && dt1.Rows.Count > 0)
                    {
                        int maxSNum = Convert.ToInt32(dt1.Rows[0]["maxS"].ToString()) + 1;
                        printNum.Update("ScwNum=" + maxSNum, string.Empty);
                        scw.Update("PrintNum=" + maxSNum, " and AppGuid='" +
                    guid + "'");
                    }
                }
            }
            else
            {
                Model.PrintNum printNum = new Model.PrintNum();
                using (DataTable dt = CNVP.Framework.DataAccess.DataFactory.GetInstance().ExecuteTable("select max(ApplyNum) as maxA from CNVP_PrintNum"))
                {
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        int maxANum = Convert.ToInt32(dt.Rows[0]["maxA"].ToString()) + 1;
                        printNum.Update("ApplyNum=" + maxANum, string.Empty);
                        apply.Update("PrintNum=" + maxANum, " and Guid='" +
                    guid + "'");
                    }
                }
            }

            //修改申请单状态
            if (!string.IsNullOrEmpty(guid))
            {
                apply.Update("AppState=" + applyState, " and Guid='" +
                    guid + "'");
                if (_appState == "1")
                {
                    if (appli.IO == 1)
                    {
                        strIO = "出港";
                    }
                    else
                    {
                        strIO = "进港";
                        Panel1.Visible = false;
                    }
                }
            }

            //增加或修改审批意见
            CNVP.UI.Application _apply = new Application();
            if (_apply.IsOpinionExist(guid))
            {
                accredit.Update("AppOpinions='" + AppOpinions.Text + "', ScwOpinions='" + ScwOpinions.Text + "'"," and AppGuid='" + guid + "'");
            }
            else
            {
                accredit.AccreditationMen = Convert.ToInt32(LoginInfo.LoginID);
                accredit.AccreditationTime = DateTime.Now;
                accredit.AppGuid = guid;
                accredit.Guid = Public.GetGuID;
                accredit.AppOpinions = AppOpinions.Text;
                accredit.ScwOpinions = ScwOpinions.Text;
                accredit.Insert(accredit);
            }

            MessageBox.ShowMessage("审批成功!", "ApplyList.aspx?State=" + _appState + "&page=" + appPage);
        }