Пример #1
0
        public DataSet getFaultInfos(DateTime starDateTime, DateTime endDateTime, string unitName, string responsibleUserName, string serviceStyle)
        {
            ArrayList      paraList                = new ArrayList();
            MySqlParameter paraStartTime           = new MySqlParameter("@paraStartTime", starDateTime);
            MySqlParameter paraEndTime             = new MySqlParameter("@paraEndTime", endDateTime);
            MySqlParameter paraUnitName            = new MySqlParameter("@paraUnitName", unitName);
            MySqlParameter paraResponsibleUserName = new MySqlParameter("@paraResponsibleUserName", responsibleUserName);
            MySqlParameter paraServiceStyle        = new MySqlParameter("@paraServiceStyle", serviceStyle);

            paraList.Add(paraStartTime);
            paraList.Add(paraEndTime);
            string sql = "SELECT a.`equip_name`,a.`equip_version`,a.`falut_info`,a.`maintenance_mode`,a.`spare_part_name`,a.`spare_part_version`,a.`spare_part_specification`,a.`spare_part_count`,a.`service_id`,b.`start_date`,b.`end_date` FROM `falut_infos` a,`services` b WHERE b.`start_date` > @paraStartTime and b.`end_date` < @paraEndTime and a.service_id = b.id";

            if (unitName != "全部" && unitName != "请选择单位")
            {
                sql += "and b.unit_name = @paraUnitName ";
                paraList.Add(paraUnitName);
            }
            if (responsibleUserName != "全部" && responsibleUserName != "请选择带队人")
            {
                sql += "and b.responsible_user_name = @paraResponsibleUserName ";
                paraList.Add(paraResponsibleUserName);
            }
            if (serviceStyle != "全部" && serviceStyle != "请选择服务类型")
            {
                sql += "and b.service_style = @paraServiceStyle";
                paraList.Add(paraServiceStyle);
            }
            return(MySqlHelper.GetDataSet(MySqlHelper.conn, CommandType.Text, sql, (MySqlParameter[])paraList.ToArray(typeof(MySqlParameter))));
        }
Пример #2
0
 public void addOrUpdateCustomer(string customerId, string unitName, string address, string responsibleUserName, string tel, string fax, string email)
 {
     try
     {
         MySqlParameter paraUnitName            = new MySqlParameter("@paraUnitName", unitName);
         MySqlParameter paraAddress             = new MySqlParameter("@paraAddress", address);
         MySqlParameter paraResponsibleUserName = new MySqlParameter("@paraResponsibleUserName", responsibleUserName);
         MySqlParameter paraTel   = new MySqlParameter("@paraTel", tel);
         MySqlParameter paraFax   = new MySqlParameter("@paraFax", fax);
         MySqlParameter paraEmail = new MySqlParameter("@paraEmail", email);
         if (customerId != string.Empty)
         {
             MySqlParameter paraId = new MySqlParameter("@paraId", customerId);
             string         sql    = "update customer set unit_name = @paraUnitName,address = @paraAddress,responsible_user_name = @paraResponsibleUserName,tel = @paraTel,fax = @paraFax, email = @paraEmail where id = @paraId";
             MySqlHelper.ExecuteNonQuery(common.MySqlHelper.conn, CommandType.Text, sql, paraUnitName, paraAddress, paraResponsibleUserName, paraTel, paraFax, paraEmail, paraId);
         }
         else
         {
             string sql = "insert into customer(unit_name,address,responsible_user_name,tel,fax,email) values(@paraUnitName,@paraAddress,@paraResponsibleUserName,@paraTel,@paraFax,@paraEmail)";
             MySqlHelper.ExecuteNonQuery(MySqlHelper.conn, CommandType.Text, sql, paraUnitName, paraAddress, paraResponsibleUserName, paraTel, paraFax, paraEmail);
         }
     }
     catch (Exception exception)
     {
         LogHelper.WriteLog(typeof(FormAddCustomer), exception.ToString());
     }
 }
Пример #3
0
        public List <UserInfo> getAllUserInfo()
        {
            List <UserInfo> userInfos = new List <UserInfo>();

            try
            {
                string          sql             = "select user_name,department,position,tel from user";
                MySqlDataReader mySqlDataReader = MySqlHelper.ExecuteReader(MySqlHelper.conn, CommandType.Text, sql, null);
                while (mySqlDataReader.Read())
                {
                    UserInfo userInfo = new UserInfo
                    {
                        userName   = (string)mySqlDataReader["user_name"],
                        department = (string)mySqlDataReader["department"],
                        position   = (string)mySqlDataReader["position"],
                        tel        = (string)mySqlDataReader["tel"]
                    };
                    userInfos.Add(userInfo);
                }
                mySqlDataReader.Close();
            }
            catch (Exception exception)
            {
                LogHelper.WriteLog(typeof(FormAddUser), exception.ToString());
            }
            return(userInfos);
        }
Пример #4
0
        public void addFaultInfo(List <FalutInfo> falutInfos)
        {
            int serviceId = serviceInfoDao.getMaxId();

            try
            {
                foreach (FalutInfo falutInfo in falutInfos)
                {
                    MySqlParameter paraEquipName              = new MySqlParameter("@paraEquipName", falutInfo.equipName);
                    MySqlParameter paraEquipVersion           = new MySqlParameter("@paraEquipVersion", falutInfo.equipVersion);
                    MySqlParameter paraFalutInfo              = new MySqlParameter("@paraFalutInfo", falutInfo.falutInfo);
                    MySqlParameter paraMaintenanceMode        = new MySqlParameter("@paraMaintenanceMode", falutInfo.maintenance);
                    MySqlParameter paraSparePartName          = new MySqlParameter("@paraSparePartName", falutInfo.sparePartName);
                    MySqlParameter paraSparePartVersion       = new MySqlParameter("@paraSparePartVersion", falutInfo.sparePartVersion);
                    MySqlParameter paraSparePartSpecification = new MySqlParameter("@paraSparePartSpecification", falutInfo.sparePartSpecification);
                    MySqlParameter paraSparePartPartCount     = new MySqlParameter("@paraSparePartPartCount", falutInfo.sparePartCount);
                    MySqlParameter ParaServiceId              = new MySqlParameter("@ParaServiceId", serviceId);
                    string         sql =
                        "INSERT INTO `falut_infos`(`equip_name`,`equip_version`,`falut_info`,`maintenance mode`,`spare_part_name`,`spare_part_version`,`spare_part_specification`,`spare_part_count`,`service_id`) values(@paraEquipName,@paraEquipVersion,@paraFalutInfo,@paraMaintenanceMode,@paraSparePartName,@paraSparePartVersion,@paraSparePartSpecification,@paraSparePartPartCount,@ParaServiceId)";
                    MySqlHelper.ExecuteNonQuery(MySqlHelper.conn, CommandType.Text, sql, paraEquipName, paraEquipVersion, paraFalutInfo, paraMaintenanceMode, paraSparePartName, paraSparePartVersion,
                                                paraSparePartSpecification, paraSparePartPartCount, ParaServiceId);
                }
            }
            catch (Exception e)
            {
                LogHelper.WriteLog(typeof(FalutInfoDao), e.ToString());
                throw;
            }
        }
Пример #5
0
 public void addOrUpdateUser(string userId, string userName, string department, string postion, string tel)
 {
     try
     {
         MySqlParameter paraUserName   = new MySqlParameter("@paraUserName", userName);
         MySqlParameter paraDepartment = new MySqlParameter("@paraDepartment", department);
         MySqlParameter paraPostion    = new MySqlParameter("@paraPosition", postion);
         MySqlParameter paraTel        = new MySqlParameter("@paraTel", tel);
         string         sql;
         if (userId != string.Empty)
         {
             MySqlParameter paraId = new MySqlParameter("@paraId", userId);
             sql = "update user set user_name = @paraUserName, department = @paraDepartment, position = @paraPosition, tel = @paratel where id = @paraId";
             MySqlHelper.ExecuteNonQuery(common.MySqlHelper.conn, CommandType.Text, sql, paraUserName, paraDepartment, paraPostion, paraTel, paraId);
         }
         else
         {
             sql = "insert into user(user_name,department,position,tel) values(@paraUserName,@paraDepartment,@paraPosition,@paraTel)";
             MySqlHelper.ExecuteNonQuery(MySqlHelper.conn, CommandType.Text, sql, paraUserName, paraDepartment, paraPostion, paraTel);
         }
     }
     catch (Exception exception)
     {
         LogHelper.WriteLog(typeof(FormAddUser), exception.ToString());
     }
 }
Пример #6
0
        public UserInfo getUserInfo(string userId)
        {
            UserInfo userInfo = new UserInfo();

            try
            {
                if (userId != string.Empty)
                {
                    MySqlParameter  paraUserId      = new MySqlParameter("paraUserId", userId);
                    string          sql             = "select user_name,department,position,tel from user where id = @paraUserId";
                    MySqlDataReader mySqlDataReader = MySqlHelper.ExecuteReader(MySqlHelper.conn, CommandType.Text, sql, paraUserId);
                    if (mySqlDataReader.Read())
                    {
                        userInfo.userName   = (string)mySqlDataReader["user_name"];
                        userInfo.department = (string)mySqlDataReader["department"];
                        userInfo.position   = (string)mySqlDataReader["position"];
                        userInfo.tel        = (string)mySqlDataReader["tel"];
                    }
                    mySqlDataReader.Close();
                }
            }
            catch (Exception exception)
            {
                LogHelper.WriteLog(typeof(FormAddUser), exception.ToString());
            }
            return(userInfo);
        }
Пример #7
0
        public SparePart getSparePart(string sparePartId)
        {
            SparePart sparePart = new SparePart();

            try
            {
                if (sparePartId != String.Empty)
                {
                    MySqlParameter  paraId          = new MySqlParameter("@paraId", sparePartId);
                    string          sql             = "select spare_part_name,spare_part_version,spare_part_specification from spare_parts where id = @paraId";
                    MySqlDataReader mySqlDataReader = MySqlHelper.ExecuteReader(MySqlHelper.conn, CommandType.Text, sql, paraId);
                    if (mySqlDataReader.Read())
                    {
                        sparePart.sparePartName          = (string)mySqlDataReader["spare_part_name"];
                        sparePart.sparePartVersion       = (string)mySqlDataReader["spare_part_version"];
                        sparePart.sparePartSpecification = (string)mySqlDataReader["spare_part_specification"];
                    }
                    mySqlDataReader.Close();
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(FormAddSparePart), ex.ToString());
            }
            return(sparePart);
        }
Пример #8
0
        public List <SparePart> getAllSparePart()
        {
            List <SparePart> spareParts = new List <SparePart>();

            try
            {
                string          sql             = "select spare_part_name,spare_part_version,spare_part_specification from spare_parts";
                MySqlDataReader mySqlDataReader = MySqlHelper.ExecuteReader(MySqlHelper.conn, CommandType.Text, sql, null);
                while (mySqlDataReader.Read())
                {
                    SparePart sparePart = new SparePart
                    {
                        sparePartName          = (string)mySqlDataReader["spare_part_name"],
                        sparePartVersion       = (string)mySqlDataReader["spare_part_version"],
                        sparePartSpecification = (string)mySqlDataReader["spare_part_specification"]
                    };
                    spareParts.Add(sparePart);
                }
                mySqlDataReader.Close();
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(FormAddSparePart), ex.ToString());
            }
            return(spareParts);
        }
Пример #9
0
 public void addOrUpdateEquip(string equipId, string name, string number, string version, string specification)
 {
     try
     {
         var paraName          = new MySqlParameter("@paraName", name);
         var paraNumber        = new MySqlParameter("@paraNumber", number);
         var paraVersion       = new MySqlParameter("@paraVersion", version);
         var paraSpecification = new MySqlParameter("@paraSpecification", specification);
         if (equipId != string.Empty)
         {
             var paraId = new MySqlParameter("@paraId", equipId);
             var sql    = "update equips set name = @paraName, number = @paraNumber, version = @paraVersion, specification = @paraSpecification where id = @paraId";
             MySqlHelper.ExecuteNonQuery(MySqlHelper.conn, CommandType.Text, sql, paraName, paraNumber, paraVersion, paraSpecification, paraId);
         }
         else
         {
             var sql = "insert into equips(name,number,version,specification) values(@paraName,@paraNumber,@paraVersion,@paraSpecification)";
             MySqlHelper.ExecuteNonQuery(MySqlHelper.conn, CommandType.Text, sql, paraName, paraNumber, paraVersion, paraSpecification);
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(typeof(FormAddEquip), ex.ToString());
     }
 }
Пример #10
0
        public DataSet getServiceInfos(DateTime starDateTime, DateTime endDateTime, string unitName, string responsibleUserName, string serviceStyle)
        {
            ArrayList      paraList                = new ArrayList();
            MySqlParameter paraStartTime           = new MySqlParameter("@paraStartTime", starDateTime);
            MySqlParameter paraEndTime             = new MySqlParameter("@paraEndTime", endDateTime);
            MySqlParameter paraUnitName            = new MySqlParameter("@paraUnitName", unitName);
            MySqlParameter paraResponsibleUserName = new MySqlParameter("@paraResponsibleUserName", responsibleUserName);
            MySqlParameter paraServiceStyle        = new MySqlParameter("@paraServiceStyle", serviceStyle);

            paraList.Add(paraStartTime);
            paraList.Add(paraEndTime);
            string sql =
                "SELECT `info_name`,`receiver_name`,`work_order_number`,`unit_name`,`responsible_customer_name`,`responsible_customer_tel`,`responsible_user_name`,`start_date`,`end_date`,`user_names`,`service_style`,`return_money` FROM services where start_date > @paraStartTime and end_date < @paraEndTime ";

            if (unitName != "全部" && unitName != "请选择单位")
            {
                sql += "and unit_name = @paraUnitName ";
                paraList.Add(paraUnitName);
            }
            if (responsibleUserName != "全部" && responsibleUserName != "请选择带队人")
            {
                sql += "and responsible_user_name = @paraResponsibleUserName ";
                paraList.Add(paraResponsibleUserName);
            }
            if (serviceStyle != "全部" && serviceStyle != "请选择服务类型")
            {
                sql += "and service_style = @paraServiceStyle";
                paraList.Add(paraServiceStyle);
            }
            return(MySqlHelper.GetDataSet(MySqlHelper.conn, CommandType.Text, sql, (MySqlParameter[])paraList.ToArray(typeof(MySqlParameter))));
        }
Пример #11
0
        public ServiceInfo getServiceInfoByOrderNumber(string orderNumber)
        {
            ServiceInfo    serviceInfo     = null;
            MySqlParameter paraOrderNumber = new MySqlParameter("@paraOrderNumber", orderNumber);
            string         sql             =
                "select info_name,receiver_name,brief,basic_info,work_order_number,unit_name,address,responsible_customer_name,responsible_customer_tel,responsible_customer_fax,responsible_user_name,start_date,end_date,user_names,user_count,service_style,equips_count,falut_info,return_money,`explain`,satisfied_quality,satisfied_service,satisfied_deliver,satisfied_price,suggest_appearance,suggest_attitude,suggest_price from services where work_order_number = @paraOrderNumber";
            MySqlDataReader mySqlDataReader = MySqlHelper.ExecuteReader(MySqlHelper.conn, CommandType.Text, sql, paraOrderNumber);

            while (mySqlDataReader.Read())
            {
                ServiceInfo newServiceInfo = new ServiceInfo()
                {
                    infoName                = mySqlDataReader.GetString("info_name"),
                    receiverName            = mySqlDataReader.GetString("receiver_name"),
                    brief                   = mySqlDataReader.GetString("brief"),
                    basicInfo               = mySqlDataReader.GetString("basic_info"),
                    workOderNumber          = mySqlDataReader.GetString("work_order_number"),
                    unitName                = mySqlDataReader.GetString("unit_name"),
                    address                 = mySqlDataReader.GetString("address"),
                    responsibleCustomerName = mySqlDataReader.GetString("responsible_customer_name"),
                    responsibleCustomerTel  = mySqlDataReader.GetString("responsible_customer_tel"),
                    responsibleCustomerFax  = mySqlDataReader.GetString("responsible_customer_fax"),
                    responsibleUserName     = mySqlDataReader.GetString("responsible_user_name"),
//                    responsibleUserTel = mySqlDataReader.GetString("responsible_user_tel"),
                    startDate         = mySqlDataReader.GetDateTime("start_date"),
                    endDate           = mySqlDataReader.GetDateTime("end_date"),
                    userNames         = mySqlDataReader.GetString("user_names"),
                    userCount         = mySqlDataReader.GetString("user_count"),
                    serviceStyle      = mySqlDataReader.GetString("service_style"),
                    equipsCount       = mySqlDataReader.GetString("equips_count"),
                    faultInfo         = "",
                    returnMoney       = mySqlDataReader.GetString("return_money"),
                    explain           = mySqlDataReader.GetString("explain"),
                    satisfiedQuality  = mySqlDataReader.GetString("satisfied_quality"),
                    satisfiedService  = mySqlDataReader.GetString("satisfied_service"),
                    satisfiedDeliver  = mySqlDataReader.GetString("satisfied_deliver"),
                    satisfiedPrice    = mySqlDataReader.GetString("satisfied_price"),
                    suggestAppearance = mySqlDataReader.GetString("suggest_appearance"),
                    suggestAttitude   = mySqlDataReader.GetString("suggest_attitude"),
                    suggestPrice      = mySqlDataReader.GetString("suggest_price")
                };
                serviceInfo = newServiceInfo;
            }
            return(serviceInfo);
        }
Пример #12
0
 public void addServiceInfo(ServiceInfo serviceInfo)
 {
     try
     {
         MySqlParameter paraInfoName                = new MySqlParameter("@paraInfoName", serviceInfo.infoName);
         MySqlParameter paraReceiverName            = new MySqlParameter("@paraReceiverName", serviceInfo.receiverName);
         MySqlParameter paraBrief                   = new MySqlParameter("@paraBrief", serviceInfo.brief);
         MySqlParameter paraBasicInfo               = new MySqlParameter("@paraBasicInfo", serviceInfo.basicInfo);
         MySqlParameter paraWorkOrderNumber         = new MySqlParameter("@paraWorkOrderNumber", serviceInfo.workOderNumber);
         MySqlParameter paraUnitName                = new MySqlParameter("@paraUnitName", serviceInfo.unitName);
         MySqlParameter paraAddress                 = new MySqlParameter("@paraAddress", serviceInfo.address);
         MySqlParameter paraResponsibleCustomerName = new MySqlParameter("@paraResponsibleCustomerName", serviceInfo.responsibleCustomerName);
         MySqlParameter paraResponsibleCustomerTel  = new MySqlParameter("@paraResponsibleCustomerTel", serviceInfo.responsibleCustomerTel);
         MySqlParameter paraResponsibleCustomerFax  = new MySqlParameter("@paraResponsibleCustomerFax", serviceInfo.responsibleCustomerFax);
         MySqlParameter paraResponsibleUserName     = new MySqlParameter("@paraResponsibleUserName", serviceInfo.responsibleUserName);
         MySqlParameter paraResponsibleUserTel      = new MySqlParameter("@paraResponsibleUserTel", serviceInfo.responsibleUserTel);
         MySqlParameter paraStartDate               = new MySqlParameter("@paraStartDate", serviceInfo.startDate);
         MySqlParameter paraEndDate                 = new MySqlParameter("@paraEndDate", serviceInfo.endDate);
         MySqlParameter paraUserNames               = new MySqlParameter("@paraUserNames", serviceInfo.userNames);
         MySqlParameter paraUserCount               = new MySqlParameter("@paraUserCount", serviceInfo.userCount);
         MySqlParameter paraServiceStyle            = new MySqlParameter("@paraServiceStyle", serviceInfo.serviceStyle);
         MySqlParameter paraEquipsCount             = new MySqlParameter("@paraEquipsCount", serviceInfo.equipsCount);
         MySqlParameter paraFalutInfo               = new MySqlParameter("@paraFalutInfo", serviceInfo.faultInfo);
         MySqlParameter paraReturnMoney             = new MySqlParameter("@paraReturnMoney", serviceInfo.returnMoney);
         MySqlParameter paraExplain                 = new MySqlParameter("@paraExplain", serviceInfo.explain);
         MySqlParameter paraSatisfiedQuality        = new MySqlParameter("@paraSatisfiedQuality", serviceInfo.satisfiedQuality);
         MySqlParameter paraSatisfiedService        = new MySqlParameter("@paraSatisfiedService", serviceInfo.satisfiedService);
         MySqlParameter paraSatisfiedDeliver        = new MySqlParameter("@paraSatisfiedDeliver", serviceInfo.satisfiedDeliver);
         MySqlParameter paraSatisfiedPrice          = new MySqlParameter("@paraSatisfiedPrice", serviceInfo.satisfiedPrice);
         MySqlParameter paraSuggestAppearance       = new MySqlParameter("@paraSuggestAppearance", serviceInfo.suggestAppearance);
         MySqlParameter paraSuggestAttitude         = new MySqlParameter("@paraSuggestAttitude", serviceInfo.suggestAttitude);
         MySqlParameter paraSuggestPrice            = new MySqlParameter("@paraSuggestPrice", serviceInfo.suggestPrice);
         string         sql =
             "insert into services(info_name,receiver_name,brief,basic_info,work_order_number,unit_name,address,responsible_customer_name,responsible_customer_tel,responsible_customer_fax,responsible_user_name,start_date,end_date,user_names,user_count,service_style,equips_count,falut_info,return_money,`explain`,satisfied_quality,satisfied_service,satisfied_deliver,satisfied_price,suggest_appearance,suggest_attitude,suggest_price) values(@paraInfoName,@paraReceiverName,@paraBrief,@paraBasicInfo,@paraWorkOrderNumber,@paraUnitName,@paraAddress,@paraResponsibleCustomerName,@paraResponsibleCustomerTel,@paraResponsibleCustomerFax,@paraResponsibleUserName,@paraStartDate,@paraEndDate,@paraUserNames,@paraUserCount,@paraServiceStyle,@paraEquipsCount,@paraFalutInfo,@paraReturnMoney,@paraExplain,@paraSatisfiedQuality,@paraSatisfiedService,@paraSatisfiedDeliver,@paraSatisfiedPrice,@paraSuggestAppearance,@paraSuggestAttitude,@paraSuggestPrice)";
         MySqlHelper.ExecuteNonQuery(MySqlHelper.conn, CommandType.Text, sql, paraInfoName, paraReceiverName, paraBrief, paraBasicInfo, paraWorkOrderNumber, paraUnitName, paraAddress,
                                     paraResponsibleCustomerName, paraResponsibleCustomerTel, paraResponsibleCustomerFax, paraResponsibleUserName, paraResponsibleUserTel, paraStartDate, paraEndDate, paraUserNames,
                                     paraUserCount, paraServiceStyle, paraEquipsCount, paraFalutInfo, paraReturnMoney, paraExplain, paraSatisfiedQuality, paraSatisfiedService, paraSatisfiedDeliver, paraSatisfiedPrice,
                                     paraSuggestAppearance, paraSuggestAttitude, paraSuggestPrice);
     }
     catch (Exception e)
     {
         LogHelper.WriteLog(typeof(ServiceInfoDao), e.ToString());
         throw;
     }
 }
Пример #13
0
        public List <Equip> getAllEquip()
        {
            var equips          = new List <Equip>();
            var sql             = "select name,number,version,specification from equips";
            var mySqlDataReader = MySqlHelper.ExecuteReader(MySqlHelper.conn, CommandType.Text, sql, null);

            while (mySqlDataReader.Read())
            {
                var equip = new Equip();
                equip.name          = (string)mySqlDataReader["name"];
                equip.number        = (string)mySqlDataReader["number"];
                equip.version       = (string)mySqlDataReader["version"];
                equip.specification = (string)mySqlDataReader["specification"];
                equips.Add(equip);
            }
            mySqlDataReader.Close();
            return(equips);
        }
Пример #14
0
        public CustomerInfo getCustomerInfoByUnitName(string unitName)
        {
            CustomerInfo    customerInfo    = new CustomerInfo();
            MySqlParameter  paraUnitName    = new MySqlParameter("@unitName", unitName);
            string          sql             = "select unit_name,address,responsible_user_name,tel,fax,email from customer where unit_name = @unitName";
            MySqlDataReader mySqlDataReader = MySqlHelper.ExecuteReader(MySqlHelper.conn, CommandType.Text, sql, paraUnitName);

            if (mySqlDataReader.Read())
            {
                customerInfo.unitName            = (string)mySqlDataReader["unit_name"];
                customerInfo.address             = (string)mySqlDataReader["address"];
                customerInfo.responsibleUserName = (string)mySqlDataReader["responsible_user_name"];
                customerInfo.tel   = (string)mySqlDataReader["tel"];
                customerInfo.fax   = (string)mySqlDataReader["fax"];
                customerInfo.email = (string)mySqlDataReader["email"];
            }
            mySqlDataReader.Close();
            return(customerInfo);
        }
Пример #15
0
        public Equip getEquip(string equipId)
        {
            var equip = new Equip();

            if (equipId != string.Empty)
            {
                var paraId          = new MySqlParameter("@paraId", equipId);
                var sql             = "select name,number,version,specification from equips where id = @paraId";
                var mySqlDataReader = MySqlHelper.ExecuteReader(MySqlHelper.conn, CommandType.Text, sql, paraId);
                if (mySqlDataReader.Read())
                {
                    equip.name          = (string)mySqlDataReader["name"];
                    equip.number        = (string)mySqlDataReader["number"];
                    equip.version       = (string)mySqlDataReader["version"];
                    equip.specification = (string)mySqlDataReader["specification"];
                }
                mySqlDataReader.Close();
            }
            return(equip);
        }
Пример #16
0
        public int getMaxId()
        {
            int maxId = 0;

            try
            {
                string          sql             = "select max(id) from services";
                MySqlDataReader mySqlDataReader = MySqlHelper.ExecuteReader(MySqlHelper.conn, CommandType.Text, sql, null);
                if (mySqlDataReader.Read())
                {
                    maxId = (int)mySqlDataReader["max(id)"];
                }
                mySqlDataReader.Close();
            }
            catch (Exception e)
            {
                LogHelper.WriteLog(typeof(ServiceInfo), e.ToString());
                throw;
            }
            return(maxId);
        }
Пример #17
0
 public void addOrUpdateSparePart(string sparePartId, string SparePartName, string SparePartVersion, string SparePartSpecification)
 {
     try
     {
         MySqlParameter paraPartName          = new MySqlParameter("@paraPartName", SparePartName);
         MySqlParameter paraPartVersion       = new MySqlParameter("@paraPartVesion", SparePartVersion);
         MySqlParameter paraPartSpecification = new MySqlParameter("@paraPartSpecification", SparePartSpecification);
         if (sparePartId != string.Empty)
         {
             MySqlParameter paraId = new MySqlParameter("@paraId", sparePartId);
             string         sql    = "update spare_parts set spare_part_name = @paraPartName, spare_part_version = @paraPartVesion, spare_part_specification = @paraPartSpecification where id = @paraId";
             MySqlHelper.ExecuteNonQuery(common.MySqlHelper.conn, CommandType.Text, sql, paraPartName, paraPartVersion, paraPartSpecification, paraId);
         }
         else
         {
             string sql = "insert into spare_parts(spare_part_name,spare_part_version,spare_part_specification) values(@paraPartName,@paraPartVesion,@paraPartSpecification)";
             MySqlHelper.ExecuteNonQuery(MySqlHelper.conn, CommandType.Text, sql, paraPartName, paraPartVersion, paraPartSpecification);
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(typeof(FormAddSparePart), ex.ToString());
     }
 }
Пример #18
0
        public List <CustomerInfo> getAllCustomerInfo()
        {
            List <CustomerInfo> customerInfos = new List <CustomerInfo>();

            {
                string          sql             = "select unit_name,address,responsible_user_name,tel,fax,email from customer";
                MySqlDataReader mySqlDataReader = MySqlHelper.ExecuteReader(MySqlHelper.conn, CommandType.Text, sql, null);
                while (mySqlDataReader.Read())
                {
                    CustomerInfo customerInfo = new CustomerInfo
                    {
                        unitName            = (string)mySqlDataReader["unit_name"],
                        address             = (string)mySqlDataReader["address"],
                        responsibleUserName = (string)mySqlDataReader["responsible_user_name"],
                        tel   = (string)mySqlDataReader["tel"],
                        fax   = (string)mySqlDataReader["fax"],
                        email = (string)mySqlDataReader["email"]
                    };
                    customerInfos.Add(customerInfo);
                }
                mySqlDataReader.Close();
            }
            return(customerInfos);
        }