public xFormula(xPerformance p, string reg) { region = reg; vendor = p.vendor; vendorname = p.vendorname; totalpocost = p.totalposcost; deliveredpocost = p.totalpostdeliveredcost; c3 = Convert.ToInt16(p.totalnoofpos); d3 = Convert.ToDecimal(p.totalposcost); e3 = Convert.ToDecimal(p.totalpostdeliveredcost); h3 = Convert.ToDecimal(p.totalnoofexpiredpo); i3 = Convert.ToDecimal(p.totalnooflatedelivered); j3 = Convert.ToDecimal(p.totallatedays); l3 = Convert.ToDecimal(p.totalearlyday); //k3 = Convert.ToInt16(p.totalnoofearlydeliered); //f3 = Convert.ToInt16(p.totalnoofontimepos); //g3 = Convert.ToInt16(p.totalnooffullydelivered); }
public xPerformance getCSVInfo(string empid, string searcby, string filePath) { var userInfo = new xPerformance(); string[] csvHandler; using (StreamReader CsvReader = new StreamReader(filePath)) { string inputLine = ""; while ((inputLine = CsvReader.ReadLine()) != null) { char[] delimiterChars = { ',' }; csvHandler = inputLine.Split(delimiterChars); var sindex = Convert.ToInt32(searcby); var isSuccess = false; if (sindex == 0) { if (csvHandler[0].Equals(empid)) { isSuccess = true; } } else { var newName = csvHandler[1].ToString().Replace("\"", ""); if (newName.Contains(empid)) { isSuccess = true; } } if (isSuccess) { userInfo.company = csvHandler[0].ToString(); userInfo.store = csvHandler[0].ToString(); userInfo.region = csvHandler[0].ToString(); userInfo.vendor = csvHandler[0].ToString(); userInfo.vendorname = csvHandler[0].ToString(); userInfo.pono = csvHandler[0].ToString(); userInfo.poentrydate = csvHandler[0].ToString(); userInfo.totalnoofpos = csvHandler[0].ToString(); userInfo.totalnoofposdelivered = csvHandler[0].ToString(); userInfo.totalposcost = csvHandler[0].ToString(); userInfo.totalpostdeliveredcost = csvHandler[0].ToString(); //userInfo.totalpostdeliveredretail = csvHandler[0].ToString(); //userInfo.totalnoofontimepos = csvHandler[0].ToString(); //userInfo.totalnooffullydelivered = csvHandler[0].ToString(); userInfo.totalnoofexpiredpo = csvHandler[0].ToString(); userInfo.totalnooflatedelivered = csvHandler[0].ToString(); userInfo.totallatedays = csvHandler[0].ToString(); //userInfo.totalnoofearlydeliered = csvHandler[0].ToString(); userInfo.totalearlyday = csvHandler[0].ToString(); } } CsvReader.Close(); } return(userInfo); }