Пример #1
0
        /// <summary>
        /// It handles the formclosing event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Server_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (MessageBox.Show("Are you sure ? ", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != System.Windows.Forms.DialogResult.Yes)
                {
                    e.Cancel = true;
                }
                else
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load("MyConfig.xml");
                    XmlElement root = doc.DocumentElement;

                    string          userName = root.Attributes["username"].Value;
                    int             port     = int.Parse(root.Attributes["port"].Value);
                    string          ip       = root.Attributes["ip"].Value;
                    DBServiceClient srv      = new DBServiceClient();
                    srv.removeUserFromOnlineUsersTable(userName, port, ip);
                    if (Server != null)
                    {
                        Server.Disconnect(MachineInfo.GetJustIP());
                    }
                    e.Cancel = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "FTP File Sharing", MessageBoxButtons.OK, MessageBoxIcon.Error);
                e.Cancel = false;
            }
        }
Пример #2
0
    public DataTable GetReportList(string stockCode)
    {
        try
        {
            DBServiceClient      client   = new DBServiceClient();
            ProcedureParameter[] paraList = new ProcedureParameter[10];

            if (stockCode == null || stockCode.Length == 0 || stockCode == "*")
            {
                return(null);
            }

            paraList[0] = new ProcedureParameter(); paraList[0].Name = "i_reportid"; paraList[0].Value = null; paraList[0].Direction = ParameterDirection.Input; paraList[0].Type = ProcedureParameter.DBType.BigInt;
            paraList[1] = new ProcedureParameter(); paraList[1].Name = "i_analystid"; paraList[1].Value = null; paraList[1].Direction = ParameterDirection.Input; paraList[1].Type = ProcedureParameter.DBType.BigInt;
            paraList[2] = new ProcedureParameter(); paraList[2].Name = "i_stockcode"; paraList[2].Value = stockCode; paraList[2].Direction = ParameterDirection.Input; paraList[2].Type = ProcedureParameter.DBType.NVarChar;
            paraList[3] = new ProcedureParameter(); paraList[3].Name = "i_reporttype1"; paraList[3].Value = null; paraList[3].Direction = ParameterDirection.Input; paraList[3].Type = ProcedureParameter.DBType.BigInt;
            paraList[4] = new ProcedureParameter(); paraList[4].Name = "i_reporttype2"; paraList[4].Value = null; paraList[4].Direction = ParameterDirection.Input; paraList[4].Type = ProcedureParameter.DBType.BigInt;
            paraList[5] = new ProcedureParameter(); paraList[5].Name = "i_reportname"; paraList[5].Value = null; paraList[5].Direction = ParameterDirection.Input; paraList[5].Type = ProcedureParameter.DBType.NVarChar;
            paraList[6] = new ProcedureParameter(); paraList[6].Name = "i_keywords"; paraList[6].Value = null; paraList[6].Direction = ParameterDirection.Input; paraList[6].Type = ProcedureParameter.DBType.NVarChar;
            paraList[7] = new ProcedureParameter(); paraList[7].Name = "i_reportdate1"; paraList[7].Value = null; paraList[7].Direction = ParameterDirection.Input; paraList[7].Type = ProcedureParameter.DBType.Date;
            paraList[8] = new ProcedureParameter(); paraList[8].Name = "i_reportdate2"; paraList[8].Value = null; paraList[8].Direction = ParameterDirection.Input; paraList[8].Type = ProcedureParameter.DBType.Date;

            paraList[9] = new ProcedureParameter(); paraList[9].Name = "o_cursor"; paraList[9].Direction = ParameterDirection.Output; paraList[9].Type = ProcedureParameter.DBType.Cursor;

            DataSet ds = client.ExecuteStoredProcedure("db1_proc_selectequityreport", paraList);
            return(ds.Tables[0]);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Пример #3
0
		/////////////////////////////////////////////////////////////////////////////
		public void GetDataSet(string query, EventHandler requestCompleteHandler)
		{
			m_RequestCompleteHandler = requestCompleteHandler;

			try
			{
#if EXPLICIT
				// It is not really necessary to pass a binding and an endpoint address when creating the service proxy,
				// however, we want to dynamically choose either localhost or the web server
				Uri webServiceUri = new Uri("http://localhost:51698/DBService.svc");
//j				Uri webServiceUri = new Uri("http://facetofacesoftware.com/FutureMoneyWebServices/DBService.svc");
//j				Uri webServiceUri = new Uri("http://www.dreamnit.com/FutureMoneyWebServices/DBService.svc");
				DBServiceClient px = new DBServiceClient(new BasicHttpBinding(), new EndpointAddress(webServiceUri));
#else
				DBServiceClient px = new DBServiceClient();
#endif
				px.GetOleDbDataSetCompleted += GetDataSetCompleted;
				px.GetOleDbDataSetAsync(query);
			}
			catch (Exception e)
			{
				if (m_RequestCompleteHandler != null)
					m_RequestCompleteHandler.Invoke(e.Message, null);
			}
		}
Пример #4
0
        private string GetCellLotList(string materialType, string lineCode, string routeStepName, string orderNumber, string equipmentCode)
        {
            string materialLot = null;
            string sql2        = string.Format(@"SELECT TOP 1 t1.MATERIAL_LOT
                                          FROM [dbo].[LSM_MATERIAL_LOADING_DETAIL] t1 
                                              INNER JOIN dbo.LSM_MATERIAL_LOADING t2  ON t2.LOADING_KEY=t1.LOADING_KEY
                                              INNER JOIN [dbo].[FMM_MATERIAL] t3 ON t3.MATERIAL_CODE=t1.MATERILA_CODE
                                          WHERE t3.MATERIAL_TYPE like '{0}%' AND t2.LINE_CODE='{1}'
		                                             AND t2.ROUTE_OPERATION_NAME='{2}' AND t1.ORDER_NUMBER='{3}'
		                                             AND t2.EQUIPMENT_CODE='{4}' AND t1.CURRENT_QTY>0
                                          ORDER BY t1.EDIT_TIME DESC,t1.ITEM_NO ASC"
                                               , materialType
                                               , lineCode
                                               , routeStepName
                                               , orderNumber
                                               , equipmentCode
                                               );
            DataTable dt2 = new DataTable();

            using (DBServiceClient client = new DBServiceClient())
            {
                MethodReturnResult <DataTable> dtResult = client.ExecuteQuery(sql2);
                if (dtResult.Code <= 0 && dtResult.Data.Rows.Count > 0)
                {
                    dt2         = dtResult.Data;
                    materialLot = dt2.Rows[0][0].ToString();
                }
            }
            return(materialLot);
        }
Пример #5
0
 public DataTable GetUnderNetProjects()
 {
     try
     {
         DBServiceClient client = new DBServiceClient();
         string          sql    = @"Select A.Fundcode
                         , B.Name AS FundName
                         , A.Stockcode
                         , A.Stockname
                         , A.QUOTEDATE
                         , A.Price
                         , A.Volume
                         , CASE A.Success WHEN '1' THEN '有效' ELSE '无效' END AS Success
                         , A.Getvolume 
                         From db6_t_ipo A
                         LEFT JOIN db5_t_portfoliolist B
                              ON A.Fundcode = B.Code
                         WHERE A.IsActive = '1'
                         ORDER BY A.Fundcode, A.Quotedate DESC";
         DataSet         ds     = client.ExecuteSQL(sql);
         return(ds.Tables[0]);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #6
0
    public DataTable GetPortfolioList()
    {
        DBServiceClient client = new DBServiceClient();

        _PortfoliloList = client.GetPortfolios(null).Tables[0];
        return(_PortfoliloList);
    }
Пример #7
0
        public bool checkAuthentication()
        {
            string userName = UsernameTextBox.Text;
            string password = PasswordTextBox.Text;

            DBServiceClient srv = new DBServiceClient();

            return(srv.checkAuthentication(userName, password));
        }
Пример #8
0
 private void GetUser()
 {
     //连接服务端
     EndpointAddress address = new EndpointAddress(new Uri(Application.Current.Host.Source, "/DBService.svc"));
     //建立客户端对象
     DBServiceClient client = new DBServiceClient(new BasicHttpBinding(), address);
     //添加处理事件
     client.GetUserCompleted += new EventHandler<GetUserCompletedEventArgs>(client_GetUserCompleted);
     //传入参数
     client.GetUserAsync(txtUsername.Text, pbPassword.Password);
 }
Пример #9
0
    public string GetReportServerURL()
    {
        if (_reportURL.Length == 0)
        {
            DBServiceClient client = new DBServiceClient();
            string          ip     = client.GetAlternativeSiteIP();

            _reportURL = @"http://" + ip + @"/equityreport/default.aspx";
        }

        return(_reportURL);
    }
Пример #10
0
    private DataTable GetFundSecurityPool(string stockCode, string industryOrRating, bool inBasePool, bool inCorePool, bool inRestPool, bool inProhPool, int analystId, bool isEquity, DateTime startdate, DateTime enddate, int hedgefundId)
    {
        try
        {
            DBServiceClient      client   = new DBServiceClient();
            ProcedureParameter[] paraList = new ProcedureParameter[11];

            if (stockCode == null || stockCode.Length == 0 || stockCode == "*")
            {
                stockCode = "%";
            }
            stockCode = stockCode.Replace("*", "%");

            if (industryOrRating == null || industryOrRating.Length == 0 || industryOrRating == "*")
            {
                industryOrRating = "%";
            }
            industryOrRating = industryOrRating.Replace("*", "%");

            paraList[1]  = new ProcedureParameter(); paraList[1].Name = "i_stockcode"; paraList[1].Value = stockCode.ToUpper(); paraList[1].Direction = ParameterDirection.Input; paraList[1].Type = ProcedureParameter.DBType.NVarChar;
            paraList[2]  = new ProcedureParameter(); paraList[2].Name = "i_inbasepool"; paraList[2].Value = inBasePool ? "1" : null; paraList[2].Direction = ParameterDirection.Input; paraList[2].Type = ProcedureParameter.DBType.Char;
            paraList[3]  = new ProcedureParameter(); paraList[3].Name = "i_incorepool"; paraList[3].Value = inCorePool ? "1" : null; paraList[3].Direction = ParameterDirection.Input; paraList[3].Type = ProcedureParameter.DBType.Char;
            paraList[4]  = new ProcedureParameter(); paraList[4].Name = "i_inprohpool"; paraList[4].Value = inProhPool ? "1" : null; paraList[4].Direction = ParameterDirection.Input; paraList[4].Type = ProcedureParameter.DBType.Char;
            paraList[5]  = new ProcedureParameter(); paraList[5].Name = "o_cursor"; paraList[5].Type = ProcedureParameter.DBType.Cursor; paraList[5].Direction = ParameterDirection.Output;
            paraList[6]  = new ProcedureParameter(); paraList[6].Name = "i_analystid"; paraList[6].Value = analystId; paraList[6].Direction = ParameterDirection.Input; paraList[6].Type = ProcedureParameter.DBType.Int;
            paraList[7]  = new ProcedureParameter(); paraList[7].Name = "i_inrestpool"; paraList[7].Value = inRestPool ? "1" : null; paraList[7].Direction = ParameterDirection.Input; paraList[7].Type = ProcedureParameter.DBType.Char;
            paraList[8]  = new ProcedureParameter(); paraList[8].Name = "i_startdate"; paraList[8].Value = startdate.ToString("yyyyMMdd"); paraList[8].Direction = ParameterDirection.Input; paraList[8].Type = ProcedureParameter.DBType.NVarChar;
            paraList[9]  = new ProcedureParameter(); paraList[9].Name = "i_enddate"; paraList[9].Value = enddate.ToString("yyyyMMdd"); paraList[9].Direction = ParameterDirection.Input; paraList[9].Type = ProcedureParameter.DBType.NVarChar;
            paraList[10] = new ProcedureParameter(); paraList[10].Name = "i_hedgefundid"; paraList[10].Value = hedgefundId; paraList[10].Direction = ParameterDirection.Input; paraList[10].Type = ProcedureParameter.DBType.Int;

            paraList[0] = new ProcedureParameter(); paraList[0].Value = industryOrRating; paraList[0].Direction = ParameterDirection.Input; paraList[0].Type = ProcedureParameter.DBType.NVarChar;

            DataSet ds = null;

            if (isEquity)
            {
                paraList[0].Name = "i_swindustry";
                ds = client.ExecuteStoredProcedure("db2_proc_selectfundequitypool", paraList);
            }
            else
            {
                paraList[0].Name = "i_rating";
                ds = client.ExecuteStoredProcedure("db2_proc_selectfundbondpool", paraList);
            }

            return(ds.Tables[0]);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Пример #11
0
 public static void SetMailsData(Mail mailData)
 {
     try
     {
         DBServiceClient dws = new DBServiceClient();
         dws.SetMailsData(mailData);
         dws.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Пример #12
0
 public static void DeleteMailsData(int ID)
 {
     try
     {
         DBServiceClient dws = new DBServiceClient();
         dws.DeleteMailsData(ID);
         dws.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Пример #13
0
    public DataTable GetIPOUndernet()
    {
        //获得网下参与新股申购的列表
        DBServiceClient client = new DBServiceClient();
        string          sql    = @"Select * 
                        From db6_t_ipo t
                        Where 1=1
                        AND (quotedate is null OR QuoteDate > sysdate-30)";

        DataSet ds = client.ExecuteSQL(sql);

        return(ds.Tables[0]);
    }
Пример #14
0
        public static List <Employee> GetEmployees()
        {
            List <Employee> employeesList = new List <Employee>();

            try
            {
                DBServiceClient dws = new DBServiceClient();
                employeesList = dws.GetEmployees();
                dws.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            return(employeesList);
        }
Пример #15
0
        public static List <Mail> GetMails(bool isSender, int chosenID)
        {
            List <Mail> mailsList = new List <Mail>();

            try
            {
                DBServiceClient dws = new DBServiceClient();
                mailsList = dws.GetMails(isSender, chosenID);
                dws.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            return(mailsList);
        }
Пример #16
0
        public static List <Tag> GetTags()
        {
            List <Tag> tagsList = new List <Tag>();

            try
            {
                DBServiceClient dws = new DBServiceClient();
                tagsList = dws.GetTags();
                dws.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            return(tagsList);
        }
Пример #17
0
    public DataTable GetStatisticData(bool isGroupByIndustry)
    {
        string sql = "";

        if (isGroupByIndustry)
        {
            sql = "select * from db2_v_fundequitypoolstat1";
        }
        else
        {
            sql = "select * from db2_v_fundequitypoolstat2";
        }

        DBServiceClient client = new DBServiceClient();
        DataSet         dt     = client.ExecuteSQL(sql);

        return(dt.Tables[0]);
    }
Пример #18
0
        public DataTable GetGZB(DateTime startDate, DateTime endDate, string fundCode, string itemCode)
        {
            DBServiceClient client = new DBServiceClient();

            ProcedureParameter[] paraList = new ProcedureParameter[5];

            ProcedureParameter para0 = new ProcedureParameter();

            para0.Name      = "o_cursor";
            para0.Direction = ParameterDirection.Output;
            para0.Type      = ProcedureParameter.DBType.Cursor;
            paraList[0]     = para0;

            ProcedureParameter para1 = new ProcedureParameter();

            para1.Name      = "i_fundcode"; para1.Value = fundCode;
            para1.Direction = ParameterDirection.Input;
            para1.Type      = ProcedureParameter.DBType.NVarChar;
            paraList[1]     = para1;

            ProcedureParameter para2 = new ProcedureParameter();

            para2.Name      = "i_startdate"; para2.Value = startDate.ToString("yyyyMMdd");
            para2.Direction = ParameterDirection.Input;
            para2.Type      = ProcedureParameter.DBType.NVarChar;
            paraList[2]     = para2;

            ProcedureParameter para3 = new ProcedureParameter();

            para3.Name      = "i_enddate"; para3.Value = endDate.ToString("yyyyMMdd");
            para3.Direction = ParameterDirection.Input;
            para3.Type      = ProcedureParameter.DBType.NVarChar;
            paraList[3]     = para3;

            ProcedureParameter para4 = new ProcedureParameter();

            para4.Name      = "i_itemcode"; para4.Value = itemCode;
            para4.Direction = ParameterDirection.Input;
            para4.Type      = ProcedureParameter.DBType.NVarChar;
            paraList[4]     = para4;

            return(client.ExecuteStoredProcedure("db5_proc_selectgzb", paraList).Tables[0]);
        }
Пример #19
0
    public DataTable GetAnalyst()
    {
        try
        {
            DataTable            dtAnalyst;
            DBServiceClient      client   = new DBServiceClient();
            ProcedureParameter[] paraList = new ProcedureParameter[1];

            paraList[0] = new ProcedureParameter(); paraList[0].Name = "o_cursor"; paraList[0].Direction = ParameterDirection.Output; paraList[0].Type = ProcedureParameter.DBType.Cursor;

            DataSet ds = client.ExecuteStoredProcedure("db1_proc_selectanalyst", paraList);
            dtAnalyst = ds.Tables[0];
            return(dtAnalyst);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Пример #20
0
    public DataTable GetTebonPortfolios(bool isTebon)
    {
        DBServiceClient client = new DBServiceClient();
        string          sql    = @"select * from db5_t_portfoliolist t where IsActive='1' ";

        if (isTebon)
        {
            sql += " AND istebon ='1' ";
        }
        else
        {
            sql += " AND istebon <>'1' ";
        }

        sql += " ORDER BY  assettype, startdate";

        DataSet ds = client.ExecuteSQL(sql);

        return(ds.Tables[0]);
    }
Пример #21
0
        /// <summary>
        /// It handles the StartClient button's click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StartClient_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(ServerPortValue.Text))
            {
                MessageBox.Show("Please enter server port.", "Client", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (string.IsNullOrEmpty(ServerIPValue.Text))
            {
                MessageBox.Show("Please enter server IP address.", "Client", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            IPAddress ipAddress;

            if (!IPAddress.TryParse(ServerIPValue.Text, out ipAddress))
            {
                MessageBox.Show("Please enter correct server IP address.", "Client", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (!GetConnection())
            {
                return;
            }

            StartClient.Enabled = false;
            ShareFolder.Enabled = true;
            Refresh.Enabled     = true;

            XmlDocument doc = new XmlDocument();

            doc.Load("MyConfig.xml");
            XmlElement root = doc.DocumentElement;

            string          userName = root.Attributes["username"].Value;
            int             port     = int.Parse(root.Attributes["port"].Value);
            string          ip       = root.Attributes["ip"].Value;
            DBServiceClient srv      = new DBServiceClient();

            srv.addUserToOnlineUsersTable(userName, port, ip);
        }
Пример #22
0
    public DataTable GetIndustryCodes()
    {
        try
        {
            if (_dtIndustryCode == null)
            {
                DBServiceClient      client   = new DBServiceClient();
                ProcedureParameter[] paraList = new ProcedureParameter[1];

                paraList[0] = new ProcedureParameter(); paraList[0].Name = "o_cursor"; paraList[0].Direction = ParameterDirection.Output; paraList[0].Type = ProcedureParameter.DBType.Cursor;

                DataSet ds = client.ExecuteStoredProcedure("db2_proc_selectIndustrycodes", paraList);
                _dtIndustryCode = ds.Tables[0];
            }

            return(_dtIndustryCode);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Пример #23
0
    public DataTable GetFundSecurityPoolHistory(string stockCode, DateTime startdate, DateTime enddate, bool?isEquity, int?hedgefundid)
    {
        try
        {
            if (stockCode == null || stockCode.Length == 0)
            {
                stockCode = "%";
            }

            stockCode = stockCode.Replace("*", "%");

            DBServiceClient      client   = new DBServiceClient();
            ProcedureParameter[] paraList = new ProcedureParameter[6];

            paraList[0] = new ProcedureParameter(); paraList[0].Name = "i_stockcode"; paraList[0].Value = stockCode; paraList[0].Direction = ParameterDirection.Input; paraList[0].Type = ProcedureParameter.DBType.NVarChar;
            paraList[1] = new ProcedureParameter(); paraList[1].Name = "o_cursor"; paraList[1].Type = ProcedureParameter.DBType.Cursor; paraList[1].Direction = ParameterDirection.Output;
            paraList[2] = new ProcedureParameter(); paraList[2].Name = "i_startdate"; paraList[2].Value = startdate.ToString("yyyyMMdd"); paraList[2].Direction = ParameterDirection.Input; paraList[2].Type = ProcedureParameter.DBType.NVarChar;
            paraList[3] = new ProcedureParameter(); paraList[3].Name = "i_enddate"; paraList[3].Value = enddate.ToString("yyyyMMdd"); paraList[3].Direction = ParameterDirection.Input; paraList[3].Type = ProcedureParameter.DBType.NVarChar;

            paraList[4] = new ProcedureParameter(); paraList[4].Name = "i_sectype"; paraList[4].Value = (isEquity == null || isEquity.Value == false) ? "B" : "E"; paraList[4].Direction = ParameterDirection.Input; paraList[4].Type = ProcedureParameter.DBType.Char;
            paraList[5] = new ProcedureParameter(); paraList[5].Name = "i_hedgefundid"; paraList[5].Value = hedgefundid;  paraList[5].Direction = ParameterDirection.Input; paraList[5].Type = ProcedureParameter.DBType.Int;

            if (isEquity == null)
            {
                paraList[4].Value = null;
            }
            else
            {
                paraList[4].Value = (isEquity.Value == true ? "E" : "B");
            }

            DataSet ds = client.ExecuteStoredProcedure("db2_proc_selectfundequityhist", paraList);
            return(ds.Tables[0]);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Пример #24
0
        public ActionResult Query(ContrastColorViewModel mode)
        {
            String countTotal = string.Format(@"select count(*) from dbo.v_LotColor where create_time>'{0}' and create_time<'{1}'", mode.StartTestTime, mode.EndTestTime);
            String countSame  = string.Format(@"select count(*)  from dbo.v_LotColor where  Color=InspctResult and create_time>'{0}' and create_time<'{1}'", mode.StartTestTime, mode.EndTestTime);

            DataTable dtCountTotal = new DataTable();
            DataTable dtCountSame  = new DataTable();
            String    Proportion;

            using (DBServiceClient client = new DBServiceClient())
            {
                MethodReturnResult <DataTable> resultCountTotal = client.ExecuteQuery(countTotal);
                MethodReturnResult <DataTable> resultCountSame  = client.ExecuteQuery(countSame);
                if (resultCountSame.Code == 0 && resultCountTotal.Code == 0)
                {
                    dtCountSame        = resultCountSame.Data;
                    dtCountTotal       = resultCountTotal.Data;
                    Proportion         = (Convert.ToDouble(dtCountSame.Rows[0][0]) / Convert.ToDouble(dtCountTotal.Rows[0][0]) * 100).ToString().Substring(0, 4) + "%";
                    ViewBag.Proportion = Proportion;
                }
            }
            return(PartialView("_ListPartial"));
        }
Пример #25
0
        public async Task<ActionResult> ExportToExcelPackage(IVTestDataForPackageQueryViewModel model)
        {


            JsonResult JsonResult = null;

            StringBuilder where = new StringBuilder();
            char[] splitChars = new char[] { ',', '$' };
            string[] packageNos = model.PackageNo.TrimEnd(splitChars).Split(splitChars);


            if (packageNos.Length <= 1)
            {
                where.AppendFormat("'" + packageNos[0] + "'");
            }
            else
            {
                foreach (string package in packageNos)
                {
                    where.AppendFormat("'{0}',", package);
                }
                where.Remove(where.Length - 1, 1);
            }
            String sql = string.Format(@"select 
											    t1.PACKAGE_NO,
											    t1.ITEM_NO,
											    t1.OBJECT_NUMBER,
											    t1.MATERIAL_CODE,
											    t5.MAIN_RAW_QTY,
                                                t3.GRADE,
                                                t3.COLOR,
                                                convert(decimal(18,2), t2.COEF_PMAX) COEF_PMAX ,
											    convert(decimal(18,2), t2.COEF_ISC)COEF_ISC,
											    convert(decimal(18,2), t2.COEF_VOC)COEF_VOC,
											    convert(decimal(18,2), t2.COEF_IMAX)COEF_IMAX,
											    convert(decimal(18,2), t2.COEF_VMAX)COEF_VMAX,
											    convert(decimal(18,2), t2.COEF_FF)COEF_FF,
											    t4.PM_NAME,
											    t2.PS_SUBCODE
                                                from WIP_PACKAGE_DETAIL t1
                                                inner join WIP_LOT t3 on t1.OBJECT_NUMBER =t3.LOT_NUMBER
                                                left join ZWIP_IV_TEST t2  on t1.OBJECT_NUMBER =t2.LOT_NUMBER
                                                inner join ZFMM_POWERSET t4 on t2.PS_CODE = t4.PS_CODE and t2.PS_ITEM_NO = t4.ITEM_NO
											    inner join FMM_MATERIAL t5 on t1.MATERIAL_CODE =t5.MATERIAL_CODE
                                            where 
                                                t2.IS_DEFAULT =1
                                                and t1.PACKAGE_NO 
											    in ({0}) 
											order by PACKAGE_NO,ITEM_NO", where);
            DataTable dt = new DataTable();
            using (DBServiceClient client = new DBServiceClient())
            {
                MethodReturnResult<DataTable> result = client.ExecuteQuery(sql);
                if (result.Code == 0)
                {
                    dt = result.Data;
                }
            }

            string template_path = Server.MapPath("~\\Labels\\");//模板路径
            string template_file = template_path + "Flash report 模板.xls";
            FileInfo tempFileInfo = new FileInfo(template_file);
            FileStream file = new FileStream(template_file, FileMode.Open, FileAccess.Read);
            IWorkbook hssfworkbook = new HSSFWorkbook(file);

            //创建sheet
            //Number Pallet No.  Type S/N  Pmp [W]  Isc [A]  Voc [V]  Imp [A]  Vmp [V]  FF  Pnom (W)  Current(A)
            NPOI.SS.UserModel.ISheet sheet1 = hssfworkbook.GetSheet("Sheet0");

            //创建单元格和单元格样式

            ICellStyle styles = hssfworkbook.CreateCellStyle();
            styles.FillForegroundColor = 10;
            styles.BorderBottom = BorderStyle.Thin;
            styles.BorderLeft = BorderStyle.Thin;
            styles.BorderRight = BorderStyle.Thin;
            styles.BorderTop = BorderStyle.Thin;
            styles.VerticalAlignment = VerticalAlignment.Center;
            styles.Alignment = HorizontalAlignment.Center;

            IFont font = hssfworkbook.CreateFont();
            font.Boldweight = 10;
            styles.SetFont(font);
            ICellStyle style = hssfworkbook.CreateCellStyle();
            style.FillForegroundColor = 10;
            style.BorderBottom = BorderStyle.Thin;
            style.BorderLeft = BorderStyle.Thin;
            style.BorderRight = BorderStyle.Thin;
            style.BorderTop = BorderStyle.Thin;
            style.VerticalAlignment = VerticalAlignment.Center;
            IFont fonts = hssfworkbook.CreateFont();
            font.Boldweight = 10;
            //style.DataFormat = format.GetFormat("yyyy年m月d日");  

            for (int j = 0; j < dt.Rows.Count; j++)
            {
                ICell cellData = null;
                IRow rowData = null;

                rowData = sheet1.CreateRow(j + 3);

                #region //数据
                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(j + 1);  //序号

                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["PACKAGE_NO"].ToString());


                String a = dt.Rows[j]["MATERIAL_CODE"].ToString();
                int b = Convert.ToInt32(dt.Rows[j]["MAIN_RAW_QTY"]);
                String Type = string.Format("JNM{0}{1}"
                             , a.StartsWith("1201") ? "M" : "P"
                             , b.ToString());

                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(Type);


                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["OBJECT_NUMBER"].ToString());

                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["COEF_PMAX"].ToString());

                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["COEF_ISC"].ToString());

                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["COEF_IMAX"].ToString());

                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["COEF_VOC"].ToString());

                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["COEF_VMAX"].ToString());

                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["COEF_FF"].ToString());

                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["PM_NAME"].ToString());

                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["PS_SUBCODE"].ToString());

                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["GRADE"].ToString());

                cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["COLOR"].ToString());



                #endregion
            }
            MemoryStream ms = new MemoryStream();
            hssfworkbook.Write(ms);
            ms.Flush();
            ms.Position = 0;
            return File(ms, "application/vnd.ms-excel", "IVTestDataData.xls");

        }
Пример #26
0
        MethodReturnResult GetLot(string lotNumber)
        {
            bool IsMapChkLotState = false;

            //获取是否允许无限制条件(批次状态)匹配优化器
            using (BaseAttributeValueServiceClient ClientOfBASE = new BaseAttributeValueServiceClient())
            {
                IList <BaseAttributeValue> lstBaseAttributeValue = new List <BaseAttributeValue>();
                PagingConfig pg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format("Key.CategoryName='SystemParameters' and Key.AttributeName='MapChkLotState' ")
                };
                MethodReturnResult <IList <BaseAttributeValue> > r = ClientOfBASE.Get(ref pg);
                if (r.Code <= 0 && r.Data != null)
                {
                    lstBaseAttributeValue = r.Data;
                    IsMapChkLotState      = Convert.ToBoolean(lstBaseAttributeValue[0].Value);
                }
            }
            MethodReturnResult       result = new MethodReturnResult();
            MethodReturnResult <Lot> rst    = null;
            Lot obj = null;

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                rst = client.Get(lotNumber);
                if (rst.Code == 0 && rst.Data != null)
                {
                    obj = rst.Data;
                }
                else
                {
                    result.Code    = rst.Code;
                    result.Message = rst.Message;
                    result.Detail  = rst.Detail;
                    return(result);
                }
            }

            if (obj == null || obj.Status == EnumObjectStatus.Disabled)
            {
                result.Code    = 2001;
                result.Message = string.Format(WIPResources.StringResource.LotIsNotExists, lotNumber);
                return(result);
            }
            if (IsMapChkLotState)
            {
                if (obj.StateFlag == EnumLotState.Finished)
                {
                    result.Code    = 2002;
                    result.Message = string.Format("批次({0})已完成。", lotNumber);
                    return(result);
                }
                else if (obj.Status == EnumObjectStatus.Disabled || obj.DeletedFlag == true)
                {
                    result.Code    = 2003;
                    result.Message = string.Format("批次({0})已结束。", lotNumber);
                    return(result);
                }
                else if (obj.HoldFlag == true)
                {
                    string    res  = null;
                    string    res2 = null;
                    string    sql  = string.Format(@"select ATTR_4  from WIP_LOT where LOT_NUMBER='{0}'", lotNumber);
                    DataTable dt   = new DataTable();
                    using (DBServiceClient client = new DBServiceClient())
                    {
                        MethodReturnResult <DataTable> dtResult = client.ExecuteQuery(sql);
                        if (result.Code == 0)
                        {
                            dt  = dtResult.Data;
                            res = dt.Rows[0][0].ToString();
                        }
                    }

                    string    sql2 = string.Format(@"select top 1 t2.HOLD_DESCRIPTION  from  WIP_TRANSACTION  t1
                                                   inner join [dbo].[WIP_TRANSACTION_HOLD_RELEASE]  t2 on  t1.TRANSACTION_KEY=t2.TRANSACTION_KEY
                                                   inner join WIP_LOT t3  on t3.LOT_NUMBER = t1.LOT_NUMBER  
                                                   where t1.LOT_NUMBER='{0}'
                                                   order by t2.HOLD_TIME  desc", lotNumber);
                    DataTable dt2  = new DataTable();
                    using (DBServiceClient client2 = new DBServiceClient())
                    {
                        MethodReturnResult <DataTable> dtResult2 = client2.ExecuteQuery(sql2);
                        if (result.Code == 0 && dtResult2.Data != null && dtResult2.Data.Rows.Count > 0)
                        {
                            dt2  = dtResult2.Data;
                            res2 = dt2.Rows[0][0].ToString();
                        }
                    }

                    if (dt != null && dt.Rows.Count > 0 && res != null && res != "")
                    {
                        result.Code    = 2004;
                        result.Message = string.Format("批次({0})已暂停,原因为:{1}。", lotNumber, res);
                    }
                    else if (dt != null && dt.Rows.Count > 0 && res2 != null && res2 != "")
                    {
                        result.Code    = 2004;
                        result.Message = string.Format("批次({0})已暂停。", lotNumber);
                    }
                    else
                    {
                        result.Code    = 2004;
                        result.Message = string.Format("批次({0})已暂停。", lotNumber);
                    }
                    return(result);
                }
            }
            return(rst);
        }
Пример #27
0
    public string GetAuthorizationCode()
    {
        DBServiceClient client = new DBServiceClient();

        return(client.GetAuthrizationCode());
    }
Пример #28
0
    public void UpdateFundEquityPool(string stockCode, string poolFlag, string reason, int analystId, bool isEquity, int hedgeFundId)
    {
        try
        {
            if (stockCode == null || stockCode.Length < 9)
            {
                return;
            }

            string inBase, inCore, inRest, inProh;
            inBase = inCore = inRest = inProh = null;

            switch (poolFlag)
            {
            case "0001":     //禁止
                inProh = "1";
                break;

            case "0010":     //限制
                inRest = "1";
                break;

            case "1000":     //基础
                inBase = "1";
                break;

            case "1100":     //核心
                inBase = "1";
                inCore = "1";
                break;

            case "0000":     //不分配
                break;

            default:
                break;
            }

            DBServiceClient      client = new DBServiceClient();
            ProcedureParameter[] paraList;

            paraList    = new ProcedureParameter[10];
            paraList[0] = new ProcedureParameter(); paraList[0].Name = "i_stockcode"; paraList[0].Value = stockCode; paraList[0].Direction = ParameterDirection.Input; paraList[0].Type = ProcedureParameter.DBType.NVarChar;
            paraList[1] = new ProcedureParameter(); paraList[1].Name = "i_inbasepool"; paraList[1].Value = inBase; paraList[1].Direction = ParameterDirection.Input; paraList[1].Type = ProcedureParameter.DBType.Char;
            paraList[2] = new ProcedureParameter(); paraList[2].Name = "i_incorepool"; paraList[2].Value = inCore; paraList[2].Direction = ParameterDirection.Input; paraList[2].Type = ProcedureParameter.DBType.Char;
            paraList[3] = new ProcedureParameter(); paraList[3].Name = "i_inprohpool"; paraList[3].Value = inProh; paraList[3].Direction = ParameterDirection.Input; paraList[3].Type = ProcedureParameter.DBType.Char;
            paraList[4] = new ProcedureParameter(); paraList[4].Name = "i_opuser"; paraList[4].Value = "system"; paraList[4].Direction = ParameterDirection.Input; paraList[4].Type = ProcedureParameter.DBType.NVarChar;
            paraList[5] = new ProcedureParameter(); paraList[5].Name = "i_reason"; paraList[5].Value = reason; paraList[5].Direction = ParameterDirection.Input; paraList[5].Type = ProcedureParameter.DBType.NVarChar;
            paraList[6] = new ProcedureParameter(); paraList[6].Name = "i_analystid"; paraList[6].Value = analystId; paraList[6].Direction = ParameterDirection.Input; paraList[6].Type = ProcedureParameter.DBType.Int;
            paraList[7] = new ProcedureParameter(); paraList[7].Name = "i_sectype"; paraList[7].Value = (isEquity?"E":"B"); paraList[7].Direction = ParameterDirection.Input; paraList[7].Type = ProcedureParameter.DBType.Char;
            paraList[8] = new ProcedureParameter(); paraList[8].Name = "i_inrestpool"; paraList[8].Value = inRest; paraList[8].Direction = ParameterDirection.Input; paraList[8].Type = ProcedureParameter.DBType.Char;
            paraList[9] = new ProcedureParameter(); paraList[9].Name = "i_hedgefundid"; paraList[9].Value = hedgeFundId; paraList[9].Direction = ParameterDirection.Input; paraList[9].Type = ProcedureParameter.DBType.Int;

            if (hedgeFundId == 0 || hedgeFundId == 1)
            {
                client.ExecuteNonQuery("db2_proc_updatefundpool", paraList, null);    //公募 | 专户
            }
            else if (hedgeFundId > 10)
            {
                client.ExecuteNonQuery("db2_proc_updatefundpool_hf", paraList, null); //专户: 限制|禁止
            }
            else
            {
                throw new Exception("公募/专户类别错误");
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Пример #29
0
    public DataTable GetPortfolioBenchmarkList(string portfolioCode)
    {
        DBServiceClient client = new DBServiceClient();

        return(client.GetPortfolioBenchmarks(portfolioCode).Tables[0]);
    }