Ejemplo n.º 1
0
        public ActionResult LoadDataTransferInfo(int ID)
        {
            string            strJson      = "";
            t_CM_DataTransfer DataTransfer = bll.t_CM_DataTransfer.Where(c => c.ID == ID).First();

            if (DataTransfer != null)
            {
                strJson = JsonConvert.SerializeObject(DataTransfer);
            }
            return(Content(strJson));
        }
Ejemplo n.º 2
0
        public ActionResult getDataTransfer(string SysCode)
        {
            string strJson = "";

            try
            {
                List <t_CM_DataTransfer> list = bll.t_CM_DataTransfer.Where(r => r.SysCode == SysCode).ToList();
                if (list.Count > 0)
                {
                    t_CM_DataTransfer Info = list.First();
                    strJson = JsonConvert.SerializeObject(Info);
                }
            }
            catch (Exception ex)
            {
                string error = ex.ToString();
                strJson = "error";
            }
            return(Content(strJson));
        }
Ejemplo n.º 3
0
        public ActionResult SaveDataTransferInfo(t_CM_DataTransfer info)
        {
            string result = "OK";

            try
            {
                List <t_CM_DataTransfer> list = bll.t_CM_DataTransfer.Where(p => p.SysCode == info.SysCode && p.ID != info.ID).ToList();
                if (list.Count > 0)
                {
                    result = "此子站名称已存在,请重新录入! ";
                }
                else
                {
                    if (info.ID > 0)
                    {
                        t_CM_DataTransfer DataTransferInfo = bll.t_CM_DataTransfer.Where(r => r.ID == info.ID).First();
                        DataTransferInfo.SysCode       = info.SysCode;
                        DataTransferInfo.SysName       = info.SysName;
                        DataTransferInfo.address       = info.address;
                        DataTransferInfo.SetupDate     = info.SetupDate;
                        DataTransferInfo.CommStatus    = info.CommStatus;
                        DataTransferInfo.UploadDate    = info.UploadDate;
                        DataTransferInfo.SysVersion    = info.SysVersion;
                        DataTransferInfo.SysUpdateDate = info.SysUpdateDate;
                        DataTransferInfo.pointLimit    = info.pointLimit;
                        DataTransferInfo.timeLimit     = info.timeLimit;
                        DataTransferInfo.CenterIP      = info.CenterIP;
                        DataTransferInfo.CenterPort    = info.CenterPort;
                        DataTransferInfo.UserName      = info.UserName;
                        DataTransferInfo.Pwd           = info.Pwd;
                        DataTransferInfo.DBType        = info.DBType;
                        DataTransferInfo.DBName        = info.DBName;
                        DataTransferInfo.ConnectString = info.ConnectString;
                        if (info.Remarks != null)
                        {
                            DataTransferInfo.Remarks = Server.HtmlEncode(info.Remarks).Replace("\n", "<br>");
                        }
                        else
                        {
                            DataTransferInfo.Remarks = info.Remarks;
                        }
                        bll.ObjectStateManager.ChangeObjectState(DataTransferInfo, EntityState.Modified);
                        bll.SaveChanges();
                        Common.InsertLog("子站管理", CurrentUser.UserName, "编辑子站管理信息[" + DataTransferInfo.SysCode + "]");
                    }
                    else
                    {
                        if (info.Remarks != null)
                        {
                            info.Remarks = info.Remarks.Replace("\n", "<br>");
                        }
                        else
                        {
                            info.Remarks = info.Remarks;
                        }
                        info.UseState = "0";
                        bll.t_CM_DataTransfer.AddObject(info);
                        bll.SaveChanges();
                        Common.InsertLog("子站管理", CurrentUser.UserName, "新增子站管理信息[" + info.SysCode + "]");
                    }
                }
            }
            catch (Exception ex)
            {
                result = ex.ToString();
                result = "出错了!";
            }
            return(Content(result));
        }