コード例 #1
0
        public HttpResponseMessage DescargaArchivoExcelTerceroRelLab(string nit, string razonSocialnit, string tipoTercero)
        {
            try
            {
                LNRelacionesLaborales    lnRL = new LNRelacionesLaborales();/// Defino variable gs
                EDEmpresa_Usuaria        eu   = new EDEmpresa_Usuaria();
                List <EDEmpresa_Usuaria> lstEDEmpresa_Usuaria = new List <EDEmpresa_Usuaria>();
                System.Data.DataTable    dtRows = lnRL.DescargaArchivoExcelTerceroRelLab(nit, razonSocialnit, tipoTercero);
                eu.DT = dtRows.Copy();
                lstEDEmpresa_Usuaria.Add(eu);

                if (eu.DT != null)
                {
                    var response = Request.CreateResponse(HttpStatusCode.OK, lstEDEmpresa_Usuaria);
                    return(response);
                }
                else
                {
                    var response = Request.CreateResponse(HttpStatusCode.ExpectationFailed);
                    return(response);
                }
            }
            catch (Exception ex)
            {
                var response = Request.CreateResponse(HttpStatusCode.InternalServerError);
                return(response);
            }
        }
コード例 #2
0
 private System.Data.DataTable FillFuncHandle(System.Data.DataTable dtFunc)
 {
     System.Data.DataTable dt = dtFunc.Copy();
     foreach (System.Data.DataRow s in dtFunc.Rows)
     {
         int    pEnum      = int.Parse(s["FuncHandle"].ToString());
         int    Opcode     = 0;
         int    spEnum     = int.TryParse(s["OpCode"].ToString(), out Opcode) == true ? Opcode : 0;
         string handleNos  = GetFuncHandle(pEnum);
         string shandleNos = GetFuncHandle(spEnum);
         System.Data.DataTable dtHandle  = Sev.GetTbFuncHandlesByHandleNos(handleNos);
         System.Data.DataTable sdtHandle = Sev.GetTbFuncHandlesByHandleNos(shandleNos);
         foreach (System.Data.DataRow r in dtHandle.Rows)
         {
             System.Data.DataRow Row = dt.NewRow();
             Row["Id"]         = Guid.NewGuid();
             Row["ParentId"]   = s["Id"];
             Row["FuncName"]   = s["FuncName"] + "-" + r["Name"];
             Row["FuncHandle"] = r["HandleNo"];
             Row["SortCode"]   = r["HandleNo"];
             Row["TypeId"]     = 2;
             if (sdtHandle.Select("HandleNo=" + r["HandleNo"]).ToList().Count > 0)
             {
                 Row["Enabled"] = 1;
             }
             else
             {
                 Row["Enabled"] = 0;
             }
             dt.Rows.Add(Row);
         }
     }
     return(dt);
 }
コード例 #3
0
        private void InitialNoComboBox(string table, string Key)
        {
            System.Data.DataRow   dr    = null;
            System.Data.DataTable dt    = null;
            System.Data.DataTable dtcpy = null;
            string sql = null;

            if (table == null || Key == null)
            {
                return;
            }
            sql  += "select ";
            sql  += Key;
            sql  += " as ValueMember,";
            sql  += Key;
            sql  += " as DisplayMember from ";
            sql  += table;
            sql  += " order by ";
            sql  += Key;
            dt    = TJSystem.Public.PublicStatic.db.GetDataTable(sql);
            dr    = dt.NewRow();
            dr[0] = "";
            dr[1] = "";
            dt.Rows.InsertAt(dr, 0);
            dtcpy = dt.Copy();
            this.comboBox2.DataSource    = dtcpy.DefaultView;
            this.comboBox2.ValueMember   = "ValueMember";
            this.comboBox2.DisplayMember = "DisplayMember";
        }
コード例 #4
0
ファイル: ObjectExtension.cs プロジェクト: sundysj/Hongkun
        public static System.Data.DataTable GetPagedTable(this System.Data.DataTable dt, int PageIndex, int PageSize)//PageIndex表示第几页,PageSize表示每页的记录数
        {
            if (PageIndex == 0)
            {
                return(dt);//0页代表每页数据,直接返回
            }
            System.Data.DataTable newdt = dt.Copy();
            newdt.Clear();//copy dt的框架

            int rowbegin = (PageIndex - 1) * PageSize;
            int rowend   = PageIndex * PageSize;

            if (rowbegin >= dt.Rows.Count)
            {
                return(newdt);//源数据记录数小于等于要显示的记录,直接返回dt
            }
            if (rowend > dt.Rows.Count)
            {
                rowend = dt.Rows.Count;
            }
            for (int i = rowbegin; i <= rowend - 1; i++)
            {
                System.Data.DataRow newdr = newdt.NewRow();
                System.Data.DataRow dr    = dt.Rows[i];
                foreach (System.Data.DataColumn column in dt.Columns)
                {
                    newdr[column.ColumnName] = dr[column.ColumnName];
                }
                newdt.Rows.Add(newdr);
            }
            return(newdt);
        }
コード例 #5
0
 /// <summary>
 /// 储存XML
 /// </summary>
 /// <param name="dtYhm"></param>
 /// <param name="sDSName"></param>
 /// <param name="sXMLPath"></param>
 public void SaveXML(System.Data.DataTable dtYhm, string sDSName, string sXMLPath)
 {
     lock (this)
     {
         System.Data.DataSet set = new System.Data.DataSet(sDSName);
         set.Tables.Add(dtYhm.Copy());
         set.WriteXml(sXMLPath);
     }
 }
コード例 #6
0
        public ActionResult AdjunctReport(string keyword)
        {
            string queryJson = "{\"keyword\" :\"" + keyword + "\"}";

            System.Data.DataTable model = projectDatailsIBLL.GetAdjunctReport(queryJson);
            System.Data.DataTable dt1   = model.Copy();
            dt1.Columns.Remove("Name");
            dt1.Columns.Remove("CompanyName");
            ViewBag.dynamicColumn = dt1;
            var s = dt1.Rows[0][0];

            ViewBag.model = model;

            return(View());
        }
コード例 #7
0
        private void InitialTypeComboBox()
        {
            System.Data.DataRow   dr    = null;
            System.Data.DataTable dt    = null;
            System.Data.DataTable dtcpy = null;

            dt = new System.Data.DataTable("DISPLAY");
            dt.Columns.Add("VALUE");
            dt.Columns.Add("DISPLAY");
            dr    = dt.NewRow();
            dr[0] = "1";
            dr[1] = "采购询价单";
            dt.Rows.InsertAt(dr, 0);
            dr    = dt.NewRow();
            dr[0] = "2";
            dr[1] = "供应商报价单";
            dt.Rows.InsertAt(dr, 0);
            dr    = dt.NewRow();
            dr[0] = "3";
            dr[1] = "采购订单";
            dt.Rows.InsertAt(dr, 0);
            dr    = dt.NewRow();
            dr[0] = "4";
            dr[1] = "客户询价单";
            dt.Rows.InsertAt(dr, 0);
            dr    = dt.NewRow();
            dr[0] = "5";
            dr[1] = "报价单";
            dt.Rows.InsertAt(dr, 0);
            dr    = dt.NewRow();
            dr[0] = "6";
            dr[1] = "销售订单";
            dt.Rows.InsertAt(dr, 0);
            dr    = dt.NewRow();
            dr[0] = "0";
            dr[1] = "";
            dt.Rows.InsertAt(dr, 0);
            dtcpy = dt.Copy();
            this.comboBox1.DataSource    = dtcpy.DefaultView;
            this.comboBox1.ValueMember   = "VALUE";
            this.comboBox1.DisplayMember = "DISPLAY";
        }
コード例 #8
0
 private void AddData(ExcelWorksheet worksheet, System.Data.DataTable data, int startRow)
 {
     //only load upto provided column:
     // .Range("A" & lngRow).CopyFromRecordset(ADORs, , lngLastCol)
     using (var dtCopy = data.Copy())
     {
         var columnsCount = _ExcelOptions.ColumnList.ToList().Count();
         while (dtCopy.Columns.Count > columnsCount)
         {
             dtCopy.Columns.RemoveAt(columnsCount);
         }
         worksheet.Cells[startRow, 1].LoadFromDataTable(dtCopy, false);
         //check for datetime:
         var ci = System.Threading.Thread.CurrentThread.CurrentCulture;
         for (int i = 0; i < dtCopy.Columns.Count; i++)
         {
             if (dtCopy.Columns[i].DataType == typeof(DateTime))
             {
                 worksheet.Column(i + 1).Style.Numberformat.Format = ci.DateTimeFormat.ShortDatePattern;
             }
         }
     }
 }
コード例 #9
0
ファイル: NCTaskDel.cs プロジェクト: 0000duck/software
 public System.Data.DataTable GetTaskDb()
 {
     return(TaskDb.Copy());
 }
コード例 #10
0
        public bool Execute(ref System.Data.DataSet rawDataSet)
        {
            using (System.Data.DataSet mergedRawDataSet = new System.Data.DataSet())
            {
                MultiMapList <string, string> multimapList = new MultiMapList <string, string>();

                foreach (System.Data.DataTable rawDataTable in rawDataSet.Tables)
                {
                    string tableName = rawDataTable.TableName;

                    if (tableName.Contains("_"))
                    {
                        string[] splitedTableName = tableName.Split('_');

                        if (splitedTableName.Length != 2)
                        {
                            Log.ErrorFormat("Error. Table's name has twice underbar('_'). {0}",
                                            tableName);
                            Trace.Assert(false);
                            return(false);
                        }

                        if (!multimapList.TryToAddMapping(splitedTableName[0], tableName))
                        {
                            Log.ErrorFormat("Fail to add. {0}, {1}",
                                            splitedTableName[0], tableName);
                            return(false);
                        }
                    }
                    else
                    {
                        if (!multimapList.TryToAddMapping(tableName, tableName))
                        {
                            Log.ErrorFormat("Fail to add. {0}, {1}",
                                            tableName, tableName);
                            return(false);
                        }
                    }
                }

                foreach (var kvp in multimapList)
                {
                    string        key    = kvp.Key;
                    List <string> values = kvp.Value;

                    foreach (string value in values)
                    {
                        string tableName = value;
                        System.Data.DataTable rawDataTable = rawDataSet.Tables[tableName];
                        if (rawDataTable != null)
                        {
                            System.Data.DataTable addOrMergeTable = rawDataTable.Copy();
                            addOrMergeTable.TableName = key;

                            if (!mergedRawDataSet.Tables.Contains(key))
                            {
                                mergedRawDataSet.Tables.Add(addOrMergeTable);
                            }
                            else
                            {
                                var compareSourceRow =
                                    mergedRawDataSet.Tables[key].Rows[0].ItemArray
                                    .Aggregate((lhs, rhs) => lhs + ", " + rhs);
                                var compareDestRow = addOrMergeTable.Rows[0].ItemArray
                                                     .Aggregate((lhs, rhs) => lhs + ", " + rhs);

                                if (!compareSourceRow.Equals(compareDestRow))
                                {
                                    Log.ErrorFormat("Table Schema is not matched." +
                                                    " {0}, source: {1}, dest: {2}",
                                                    key, compareSourceRow, compareDestRow);
                                    return(false);
                                }

                                addOrMergeTable.Rows.RemoveAt(0);
                                mergedRawDataSet.Tables[key].Merge(addOrMergeTable);
                            }
                        }
                    }
                }

                rawDataSet = mergedRawDataSet;
            }

            return(true);
        }
コード例 #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txt_Order_number.Text != "" && txt_Order_number.Text.Length > 0)
            {
                SplashScreenManager.ShowForm(this, typeof(Masters.WaitForm1), true, true, false);
                try
                {
                    //cPro.startProgress();
                    // form_loader.Start_progres();

                    Hashtable htselect = new Hashtable();
                    dtselect.Clear();
                    string OrderNumber = txt_Order_number.Text.ToString();


                    htselect.Add("@Trans", "SEARCH");
                    htselect.Add("@Search_By", OrderNumber);
                    dtnewselect = dataAccess.ExecuteSP("Sp_Order", htselect);
                    dt          = dtnewselect;

                    // Check in Old Server

                    htselect.Clear();

                    htselect.Add("@Trans", "SEARCH");
                    htselect.Add("@Search_By", OrderNumber);
                    dtoldselect = oldbdatacess.ExecuteSP("Sp_Order", htselect);

                    if (dtoldselect.Rows.Count > 0)
                    {
                        Old_Server_Value = "True";
                    }
                    else
                    {
                        Old_Server_Value = "False";
                    }

                    dtselect = dtnewselect.Copy();
                    dtselect.Merge(dtoldselect);


                    if (dtselect.Rows.Count > 0)
                    {
                        grd_order.Rows.Clear();
                        for (int i = 0; i < dtselect.Rows.Count; i++)
                        {
                            grd_order.Rows.Add();
                            grd_order.Rows[i].Cells[1].Value = dtselect.Rows[i]["Client_Order_Number"].ToString();
                            if (userroleid == "1")
                            {
                                grd_order.Rows[i].Cells[2].Value = dtselect.Rows[i]["Client_Name"].ToString();
                                grd_order.Rows[i].Cells[3].Value = dtselect.Rows[i]["Sub_ProcessName"].ToString();
                            }
                            else
                            {
                                grd_order.Rows[i].Cells[2].Value = dtselect.Rows[i]["Client_Number"].ToString();
                                grd_order.Rows[i].Cells[3].Value = dtselect.Rows[i]["Subprocess_Number"].ToString();
                            }

                            grd_order.Rows[i].Cells[4].Value  = dtselect.Rows[i]["Date"].ToString();
                            grd_order.Rows[i].Cells[5].Value  = dtselect.Rows[i]["Client_Order_Ref"].ToString();
                            grd_order.Rows[i].Cells[6].Value  = dtselect.Rows[i]["Order_Type"].ToString();
                            grd_order.Rows[i].Cells[7].Value  = dtselect.Rows[i]["Borrower_Name"].ToString();//BArrower Namr
                            grd_order.Rows[i].Cells[8].Value  = dtselect.Rows[i]["Address"].ToString();
                            grd_order.Rows[i].Cells[9].Value  = dtselect.Rows[i]["County"].ToString();
                            grd_order.Rows[i].Cells[10].Value = dtselect.Rows[i]["State"].ToString();
                            grd_order.Rows[i].Cells[11].Value = dtselect.Rows[i]["County_Type"].ToString();
                            grd_order.Rows[i].Cells[12].Value = dtselect.Rows[i]["Date"].ToString();//Process date Should be Completed or Recived date
                            grd_order.Rows[i].Cells[13].Value = dtselect.Rows[i]["Order_Status"].ToString();
                            grd_order.Rows[i].Cells[14].Value = dtselect.Rows[i]["Progress_Status"].ToString();
                            grd_order.Rows[i].Cells[15].Value = dtselect.Rows[i]["User_Name"].ToString();
                            grd_order.Rows[i].Cells[16].Value = dtselect.Rows[i]["Order_ID"].ToString();
                            grd_order.Rows[i].Cells[17].Value = dtselect.Rows[i]["Order_old_New"].ToString();
                            grd_order.Rows[i].Cells[18].Value = dtselect.Rows[i]["Delq_Status"].ToString();
                            if (!string.IsNullOrEmpty(grd_order.Rows[i].Cells[18].Value.ToString()))
                            {
                                if (grd_order.Rows[i].Cells[18].Value.ToString() == "1")
                                {
                                    grd_order.Rows[i].DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#ed3e3e");
                                }
                            }
                        }
                    }
                    else
                    {
                        grd_order.Visible = true;
                        grd_order.Rows.Clear();
                        grd_order.DataSource = null;
                    }

                    //cPro.stopProgress();
                }
                catch (Exception ex)
                {
                    //Close Wait Form
                    SplashScreenManager.CloseForm(false);
                    MessageBox.Show("Error Occured Please Check With Administrator");
                }
                finally
                {
                    //Close Wait Form
                    SplashScreenManager.CloseForm(false);
                }
            }
        }
コード例 #12
0
ファイル: frmConfigSaleBalance.cs プロジェクト: terry-shen/C-
        private void InitialFormData()
        {
            string sql = null;

            System.Data.DataTable   dt    = null;
            System.Data.DataTable   dtcpy = null;
            System.Data.DataTable[] dtV   = new System.Data.DataTable[11];
            System.Data.DataRow     dr    = null;
            sql   = "select ltrim(str(amount,20,2)) as pa,pa_code+' '+ltrim(str(amount,20,2))+' '+remark as pa_desc from finance_payment_detail ";
            sql  += " where ref_code in (" + this._pacode + ")";
            sql  += " order by amount";
            dt    = TJSystem.Public.PublicStatic.db.GetDataTable(sql);
            dr    = dt.NewRow();
            dr[0] = "0";
            dr[1] = "";
            dt.Rows.InsertAt(dr, 0);
            dtcpy = dt.Copy();

            for (int i = 0; i < 11; i++)
            {
                dtV[i] = dtcpy.Copy();
            }
            this.comboBox1.DataSource    = dtV[0].DefaultView;
            this.comboBox1.ValueMember   = "pa";
            this.comboBox1.DisplayMember = "pa_desc";

            this.comboBox2.DataSource    = dtV[1].DefaultView;
            this.comboBox2.ValueMember   = "pa";
            this.comboBox2.DisplayMember = "pa_desc";

            this.comboBox3.DataSource    = dtV[2].DefaultView;
            this.comboBox3.ValueMember   = "pa";
            this.comboBox3.DisplayMember = "pa_desc";

            sql  = "select";
            sql += " ltrim(str(sum(a.amount*a.exchange),20,2)) as pa,' RMB'+' '+a.term as pa_desc ";
            sql += " from finance_payawb a";
            sql += " where term in (" + this._pacode + ")";
            sql += " group by ' RMB'+' '+a.term";
//			sql = "select ltrim(str(amount,20,2)) as pa,pa_code+' '+ltrim(str(amount,20,2))+' '+pa_date as pa_desc from finance_payawb ";
            sql  += " order by pa desc";
            dt    = TJSystem.Public.PublicStatic.db.GetDataTable(sql);
            dtcpy = dt.Clone();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dr    = dtcpy.NewRow();
                dr[0] = dt.Rows[i]["pa"].ToString();
                dr[1] = dt.Rows[i]["pa"].ToString() + " " + dt.Rows[i]["pa_desc"].ToString();
                dtcpy.Rows.InsertAt(dr, 0);
            }
            dr    = dtcpy.NewRow();
            dr[0] = "0";
            dr[1] = "";
            dtcpy.Rows.InsertAt(dr, 0);
//			dtcpy = dt.Copy();
            this.comboBox4.DataSource    = dtcpy.DefaultView;
            this.comboBox4.ValueMember   = "pa";
            this.comboBox4.DisplayMember = "pa_desc";

            dtV[6] = dtcpy.Copy();

            this.comboBox5.DataSource    = dtV[4].DefaultView;
            this.comboBox5.ValueMember   = "pa";
            this.comboBox5.DisplayMember = "pa_desc";

            this.comboBox6.DataSource    = dtV[5].DefaultView;
            this.comboBox6.ValueMember   = "pa";
            this.comboBox6.DisplayMember = "pa_desc";

            this.comboBox7.DataSource    = dtV[6].DefaultView;
            this.comboBox7.ValueMember   = "pa";
            this.comboBox7.DisplayMember = "pa_desc";

            this.comboBox8.DataSource    = dtV[7].DefaultView;
            this.comboBox8.ValueMember   = "pa";
            this.comboBox8.DisplayMember = "pa_desc";

            this.comboBox9.DataSource    = dtV[8].DefaultView;
            this.comboBox9.ValueMember   = "pa";
            this.comboBox9.DisplayMember = "pa_desc";

            this.comboBox10.DataSource    = dtV[9].DefaultView;
            this.comboBox10.ValueMember   = "pa";
            this.comboBox10.DisplayMember = "pa_desc";

            this.comboBox11.DataSource    = dtV[10].DefaultView;
            this.comboBox11.ValueMember   = "pa";
            this.comboBox11.DisplayMember = "pa_desc";

            this.textBox7.Text  = this.cfg.gnyzf.ToString("f2");
            this.textBox12.Text = this.cfg.myfl.ToString("f2");
        }