Beispiel #1
0
        /// <summary>
        /// Contract_List页面行为
        /// </summary>
        /// <returns>视图</returns>
        public ActionResult Contract_List()
        {
            //获取往来客户信息
            ClientsFactory   clientsfactory = new ClientsFactory();
            List <IClientsB> lstclients     = clientsfactory.GetDataClients();
            List <ClientsM>  clientsm       = new List <ClientsM>();

            if (lstclients != null && lstclients.Count > 0)
            {
                lstclients.ForEach(p => clientsm.Add(p.Infomation_clients));
            }
            ViewBag.ClientsInfo = clientsm;

            //获取项目信息
            ProjectsFactory   projectsfactory = new ProjectsFactory();
            List <IProjectsB> lstprojects     = projectsfactory.GetDataProjects();
            List <ProjectsM>  projectsm       = new List <ProjectsM>();

            if (lstprojects != null && lstprojects.Count > 0)
            {
                lstprojects.ForEach(p => projectsm.Add(p.Infomation_projects));
            }
            ViewBag.ProjectsInfo = projectsm;

            //获取合同信息
            string          id = ViewMethods.GetForm(Request, "ID", CommonEnums.ValueEnum.vlGet).ToString();
            ContractFactory contractfactory = new ContractFactory();
            IContractB      lstContract     = contractfactory.GetDataByID(id);
            ContractM       contractm       = (lstContract != null ? lstContract.Infomation_contract : null);

            ViewBag.ContractInfo = contractm;
            return(View());
        }
Beispiel #2
0
        /// <summary>
        /// 添加合同信息(Contract_Add页面)
        /// </summary>
        public ActionResult Add_Contract()
        {
            string          prid            = ViewMethods.GetForm(Request, "PRID");
            ContractFactory contractfactory = new ContractFactory();
            //添加业主信息
            ContractM contractm    = new ContractM();
            string    contractname = ViewMethods.GetForm(Request, "name", CommonEnums.ValueEnum.vlPost).ToString();
            string    ctbelong     = ViewMethods.GetForm(Request, "belong", CommonEnums.ValueEnum.vlPost).ToString();
            string    ctno         = ViewMethods.GetForm(Request, "ctno", CommonEnums.ValueEnum.vlPost).ToString();
            decimal   ctmoney      = ViewMethods.GetForm(Request, "money", CommonEnums.ValueEnum.vlPost).ConvertToDecimal();
            string    contractdate = ViewMethods.GetForm(Request, "time_contract", CommonEnums.ValueEnum.vlPost).ToString();

            bool isExist = contractfactory.IsExist_contractname(contractname);

            if (isExist)
            {
                return(ViewMethods.AlertBack("合同已存在,请重新确认", "-1"));
            }
            contractm.CTName   = contractname;
            contractm.CTBelong = ctbelong;
            contractm.CTNo     = ctno;
            contractm.CTMoney  = ctmoney;
            contractm.CTDate   = contractdate.ConvertToDateTime();
            contractm.CTPrid   = prid.ConvertToInt32();
            contractfactory.Infomation_contract = contractm;
            contractfactory.Save();
            return(ViewMethods.AlertBack("添加合同成功!", "../../Contract/Contract?PRID=" + prid));
        }
Beispiel #3
0
        /// <summary>
        /// 编辑业主信息(Contract_Edit页面)
        /// </summary>
        public ActionResult Edit_Contract()
        {
            ContractFactory contractfactory = new ContractFactory();
            //获取业主编号(id)信息
            string id = ViewMethods.GetForm(Request, "ID", CommonEnums.ValueEnum.vlGet).ToString();

            IContractB contractb = contractfactory.GetDataByID(id);
            ContractM  contractm = (contractb == null ? null : contractb.Infomation_contract);
            //编辑业主信息
            string contractname   = ViewMethods.GetForm(Request, "name", CommonEnums.ValueEnum.vlPost).ToString();
            string contractbelong = ViewMethods.GetForm(Request, "belong", CommonEnums.ValueEnum.vlPost).ToString();

            contractm.CTName   = contractname;
            contractm.CTBelong = contractbelong;
            contractfactory.Infomation_contract = contractm;
            ViewBag.ContractInfo = contractm;
            bool isSuccess = contractfactory.Update();

            if (isSuccess)
            {
                return(ViewMethods.AlertBack("修改成功", "../../Contract/Contract"));
            }
            else
            {
                return(ViewMethods.AlertBack("修改失败", "-1"));
            }
        }
Beispiel #4
0
        /// <summary>
        /// 转换成业务逻辑层的对象
        /// </summary>
        /// <param name="contractn">集团内合同信息(模型层)</param>
        /// <returns>(业务逻辑层)对象</returns>
        IContractB ConvertToContract_B(ContractM contractm)
        {
            IContractB result = null;

            if (contractm != null)
            {
                result = new ContractB(contractm, this._connectionb);
            }
            return(result);
        }
Beispiel #5
0
        /// <summary>
        /// Contract_Edit页面行为
        /// </summary>
        /// <returns>视图</returns>
        public ActionResult Contract_Edit()
        {
            //获取往来客户(id)数据信息
            string          id = ViewMethods.GetForm(Request, "ID", CommonEnums.ValueEnum.vlGet).ToString();
            ContractFactory contractfactory = new ContractFactory();
            IContractB      lstContract     = contractfactory.GetDataByID(id);
            ContractM       contractm       = (lstContract != null ? lstContract.Infomation_contract : null);

            ViewBag.ContractInfo = contractm;
            return(View());
        }
Beispiel #6
0
        /// <summary>
        /// 将数据行中的数据添加到对象中
        /// </summary>
        /// <param name="row">数据行</param>
        /// <param name="alias">表别名</param>
        /// <returns>数据</returns>
        public static ContractM AddDataToObject(DataRow row, string alias)
        {
            ContractM result = new ContractM();

            result.CTID     = row[CommonMethods.CombineFieldAlias(TableStructM.Info_Contract.CT_ID, alias)].ConvertToInt32();
            result.CTName   = (row[CommonMethods.CombineFieldAlias(TableStructM.Info_Contract.CT_NAME, alias)].ToString());
            result.CTBelong = (row[CommonMethods.CombineFieldAlias(TableStructM.Info_Contract.CT_BELONG, alias)].ToString());
            // result.SetOnOff(row[CommonMethods.CombineFieldAlias(TableStructM.Info_Menu.MN_ONOFF, alias)].ConvertToInt32());

            return(result);
        }
Beispiel #7
0
        /// <summary>
        /// 判断合同是否存在
        /// </summary>
        /// <param name="contractname">合同名</param>
        /// <returns>合同类</returns>
        public bool IsExist_contractname(string contractname)
        {
            bool      isExist_contractname = false;
            ContractM contractm            = this._contractb.IsExist_contractname(contractname);

            if (contractm != null)
            {
                this.Infomation_contract = contractm;
                isExist_contractname     = true;
            }
            return(isExist_contractname);
        }
Beispiel #8
0
        /// <summary>
        /// 判断合同是否存在
        /// </summary>
        /// <param name="contractnname">合同名</param>
        /// <param name="connection">链接类</param>
        /// <returns>合同类</returns>
        public static ContractM IsExist_contractname(string contractname, IConnectionD connection)
        {
            ContractM result = null;

            string where = string.Format(" and {0}='{1}'", TableStructM.Info_Contract.CT_NAME, contractname.ReplaceStr());
            IList <ContractM> lst = ReadDataBase(where, connection);

            if (lst != null)
            {
                result = lst.FirstOrDefault();
            }
            return(result);
        }
Beispiel #9
0
        /// <summary>
        /// 删除业主信息(Contract页面)
        /// </summary>
        /// <returns></returns>
        public ActionResult Delete_Contract()
        {
            //获取业主编号(id)信息
            string    uid       = ViewMethods.GetForm(Request, "uid", CommonEnums.ValueEnum.vlPost).ToString();
            ContractM contractm = new ContractM();

            contractm.CTID = uid.ConvertToInt32();
            ContractFactory contractfactory = new ContractFactory();

            contractfactory.Infomation_contract = contractm;
            contractfactory.Del_Contract();
            return(new JsonResult()
            {
                Data = PublicMethods.JSonHelper <string> .ObjectToJson(new { status = "0", msg = "删除成功" }), ContentType = "json"
            });
        }
Beispiel #10
0
        /// <summary>
        /// 将数据阅读器中的数据添加到对象中
        /// </summary>
        /// <param name="dr">数据阅读器</param>
        /// <param name="alias">表别名</param>
        /// <returns>数据</returns>
        public static ContractM AddDataToObject(IDataReader dr, string alias = "")
        {
            ContractM result = new ContractM();

            result.CTID     = dr[CommonMethods.CombineFieldAlias(TableStructM.Info_Contract.CT_ID, alias)].ConvertToInt32();
            result.CTPrid   = dr[CommonMethods.CombineFieldAlias(TableStructM.Info_Contract.CT_PRID, alias)].ConvertToInt32();
            result.CTName   = (dr[CommonMethods.CombineFieldAlias(TableStructM.Info_Contract.CT_NAME, alias)].ToString());
            result.CTNo     = dr[CommonMethods.CombineFieldAlias(TableStructM.Info_Contract.CT_NO, alias)].ToString();
            result.CTClid   = dr[CommonMethods.CombineFieldAlias(TableStructM.Info_Contract.CT_CLID, alias)].ConvertToInt32();
            result.CTMoney  = dr[CommonMethods.CombineFieldAlias(TableStructM.Info_Contract.CT_MONEY, alias)].ConvertToInt32();
            result.CTDate   = dr[CommonMethods.CombineFieldAlias(TableStructM.Info_Contract.CT_DATE, alias)].ConvertToDateTime();
            result.CTBelong = (dr[CommonMethods.CombineFieldAlias(TableStructM.Info_Contract.CT_BELONG, alias)].ToString());
            // result.SetOnOff(dr[CommonMethods.CombineFieldAlias(TableStructM.Info_Menu.MN_ONOFF, alias)].ConvertToInt32());

            return(result);
        }
Beispiel #11
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="info">合同信息类(模型层)</param>
 /// <param name="connectionb">链接类</param>
 public ContractB(ContractM info, IConnectionB connectionb)
     : this(connectionb)
 {
     this.Infomation_contract = info;
 }
Beispiel #12
0
        /// <summary>
        /// 通过编号获取数据
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns>数据</returns>
        public IContractB GetDataByID(string id)
        {
            ContractM result = Methods.ReflexInvokeMethod(this._contractd, this._methodnm_GetDataByID, new Type[] { typeof(String), typeof(IConnectionD) }, new object[] { id, this._connectionb.ConnectionD }) as ContractM;

            return(ConvertToContract_B(result));
        }