Esempio n. 1
0
        public void CreateProduction(Entities.ProductionTo newProduction)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            ProductionTable _production;

            /*создание объекта добавляемой строки*/
            _production = new ProductionTable
            {
                SignCode = newProduction.SignCode,
                SortCode = newProduction.SortCode,
                TypeCode = newProduction.TypeCode,
                ProductionCode = newProduction.ProductionCode,
                NameProduction = newProduction.NameProduction,
                DesignationProduction = newProduction.DesignationProduction,
                //CountProduction = newProduction.CountProduction,
                //UnitCode = newProduction.UnitCode
            };
            // Вставка данных
            db.ProductionTable.InsertOnSubmit(_production);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 2
0
        public void Create(Entities.SostavIzdeliaTo newSostavIzdelia)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            SostavIzdelia _sostavIzdelia;

            /*создание объекта добавляемой строки*/
            _sostavIzdelia= new SostavIzdelia
            {
                Count = newSostavIzdelia.count,
                IdCurrent = newSostavIzdelia.idCurrent,
                IdIzdelia = newSostavIzdelia.idIzdelia,
                IdLast = newSostavIzdelia.idLast
            };

            // Вставка данных
            db.SostavIzdelia.InsertOnSubmit(_sostavIzdelia);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 3
0
        /// <summary>
        /// Login for recruiter in DAL layer method is LoginRecruDAL()
        /// </summary>
        /// <param name="loginEntity">The login entity</param>
        /// <returns>System.String</returns>
        public string LoginRecruDAL(Entities.LoginEnitity loginEntity)
        {
            try
            {
                connection.Open();
                //Parameters to pass to the stored procedure
                SqlParameter[] sparms = new SqlParameter[3];
                sparms[0] = new SqlParameter("@emailid", loginEntity.UserName);
                sparms[1] = new SqlParameter("@password", loginEntity.Password);
                sparms[2] = new SqlParameter("@id", SqlDbType.VarChar, 500);
                sparms[2].Direction = ParameterDirection.Output;

                SqlDataReader dr = SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure,Constants.sp_LoginRecruiter, sparms);
                string recruiterId = Convert.ToString(sparms[2].Value);

                if (string.IsNullOrEmpty(recruiterId))
                {
                    return null;
                }
                return recruiterId;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                connection.Close();
            }
        }
Esempio n. 4
0
        public void CreateDirectory(Entities.DirectoryTo newDirectory)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            DirectoryTable _directory;

            /*создание объекта добавляемой строки*/
            _directory = new DirectoryTable
            {
                MaterialCode = newDirectory.MaterialCode,
                NormMaterial = newDirectory.NormMaterial,
                NormWaste = newDirectory.NormWaste,
                ProductionCode = newDirectory.ProductionCode
            };
            // Вставка данных
            db.DirectoryTable.InsertOnSubmit(_directory);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 5
0
 //==============Insert========================
 public int InsertTyLeTinh(Entities.TyLeTinh input)
 {
     int bg = 0;
     try
     {
         con = new Connection();
         cn = con.openConnection();
         cmd = new SqlCommand("exec sp_TyLeTinh @ThaoTac,@MaTyLeTinh,@SoTien,@NgayNhap,@GhiChu,@Deleted", cn);
         cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = "insert";
         //set
         cmd.Parameters.Add("MaTyLeTinh", SqlDbType.VarChar).Value = input.MaTyLeTinh;
         cmd.Parameters.Add("SoTien", SqlDbType.Float).Value = input.SoTien;
         cmd.Parameters.Add("NgayNhap", SqlDbType.DateTime).Value = input.NgayNhap;
         cmd.Parameters.Add("GhiChu", SqlDbType.NVarChar).Value = input.GhiChu;
         cmd.Parameters.Add("Deleted", SqlDbType.Bit).Value = input.Deleted;
         bg = cmd.ExecuteNonQuery();
     }
     catch (Exception)
     {
         bg = 0;
     }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         con.closeConnection();
     }
     if (bg == 0)
         return bg;
     return bg;
 }
Esempio n. 6
0
        /// <summary>
        /// Insert
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public int Insert(Entities.KhuyenMaiSoLuong item)
        {
            int rt = 0;
            try
            {
                conn = new Connection();
                SqlConnection cn = conn.openConnection();
                string sql = "exec sp_InsertKMSL @Id,@MaHangHoa,@TenHangHoa,@NgayBatDau,@NgayKetThuc,@SoLuong,@GiaBanBuon,@GiaBanLe";
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add("Id", SqlDbType.Int).Value = 0;
                cmd.Parameters.Add("MaHangHoa", SqlDbType.VarChar, 50).Value = item.MaHangHoa;
                cmd.Parameters.Add("TenHangHoa", SqlDbType.NVarChar, 200).Value = item.TenHangHoa;
                cmd.Parameters.Add("NgayBatDau", SqlDbType.DateTime).Value = item.NgayBatDau;
                cmd.Parameters.Add("NgayKetThuc", SqlDbType.DateTime).Value = item.NgayKetThuc;
                cmd.Parameters.Add("SoLuong", SqlDbType.Float).Value = item.SoLuong;
                cmd.Parameters.Add("GiaBanBuon", SqlDbType.Float).Value = item.GiaBanBuon;
                cmd.Parameters.Add("GiaBanLe", SqlDbType.Float).Value = item.GiaBanLe;
                rt = cmd.ExecuteNonQuery();
            }
            catch
            {
                rt = 0;
            }

            return rt;
        }
 /// <summary>
 /// Method to save affirmative details in AffirmativeDetailsREDAL class
 /// </summary>
 /// <param name="affirmativeDetailsEntity">Parameter of AffirmativeDetailsEntity class</param>
 /// <returns>System.Boolean</returns>
 public bool SaveAffirmativeDetailsDAL(Entities.Recruiter.AffirmativeDetailsEntity affirmativeDetailsEntity)
 {
     int result;
     try
     {
         SqlParameter[] sqlparams ={
                                   new SqlParameter("@recruiterId",affirmativeDetailsEntity.ID),
                                   new SqlParameter("@physicallyChallenged",affirmativeDetailsEntity.PhysicallyChallenged),
                                   new SqlParameter("@description",affirmativeDetailsEntity.Description),
                                   new SqlParameter("@sports",affirmativeDetailsEntity.Sports),
                                   new SqlParameter("@sportsDescription",affirmativeDetailsEntity.SportsDescription),
                                   new SqlParameter("@usaPermit",affirmativeDetailsEntity.USAPermit),
                                   new SqlParameter("@otherPermits",affirmativeDetailsEntity.OtherPermits),
                                   new SqlParameter ("@hobbies",affirmativeDetailsEntity.Hobbies),
                                   new SqlParameter ("@extraActivity",affirmativeDetailsEntity.ExtraActivity)
                                   };
         result = SqlHelper.ExecuteNonQuery(connection, CommandType.StoredProcedure, Constants.sp_RE_InsertOtherDetails, sqlparams);
         if (result > 0)
         {
             return true;
         }
         return false;
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         connection.Close();
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Login for Jobseeker
        /// </summary>
        /// <param name="logjsEntity">The login entity for checking data from database </param>
        /// <return>SqlDataReader </returns>
        public string LoginEmpDAL(Entities.LoginEnitity logEmpEntity)
        {
            string Employerid = "";
            try
            {
                connection.Open();
                SqlCommand cmd = new SqlCommand();
                SqlParameter[] sparams = new SqlParameter[3];
                sparams[0] = new SqlParameter("@userId", logEmpEntity.UserName);
                sparams[1] = new SqlParameter("@password", logEmpEntity.Password);
                sparams[2] = new SqlParameter("@candidateid", SqlDbType.Int);
                sparams[2].Direction = ParameterDirection.Output;

                SqlDataReader dr = SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure, Constants.sp_Login, sparams);
                Employerid = sparams[2].Value.ToString();
                if (string.IsNullOrEmpty(Employerid))
                {
                    return null;
                }
                // return isreffered;

            }
            catch (Exception)
            {
                //throw ex;
            }
            finally
            {
                connection.Close();
            }
            return Employerid;
        }
Esempio n. 9
0
        public string SaveNewHrDAL(Entities.Common.RegisterEntity registerEntity)
        {
            try
            {
                connection.Open();

                SqlCommand cmd = new SqlCommand();
                SqlParameter[] param = new SqlParameter[27];
                param[0] = new SqlParameter("@adminId", registerEntity.AdminId);
                param[1] = new SqlParameter("@HrName", registerEntity.FullName);
                param[2] = new SqlParameter("@company", registerEntity.Company);
                param[3] = new SqlParameter("@officialContactNo", registerEntity.OfficialContactNo);
                param[4] = new SqlParameter("@mobNo", registerEntity.MobileNo);
                param[5] = new SqlParameter("@alternateNo", registerEntity.AlternateNo);
                param[6] = new SqlParameter("@officialEmailid", registerEntity.OfficialEmailId);
                param[7] = new SqlParameter("@personalMailId", registerEntity.PersonalMailId);
                param[8] = new SqlParameter("@freelancerOrEmployee", registerEntity.FreelanceOrEmployee);
                param[9] = new SqlParameter("@amountPerMonth", registerEntity.AmountPerMonth);
                param[10] = new SqlParameter("@percentPerClosure", registerEntity.PercentPerClosure);
                param[11] = new SqlParameter("@employeeSalary", registerEntity.EmployeeSalary);
                param[12] = new SqlParameter("@address", registerEntity.Address);
                param[13] = new SqlParameter("@presentCountry", registerEntity.PresentCountry);
                param[14] = new SqlParameter("@presentState", registerEntity.PresentState);
                param[15] = new SqlParameter("@presentCity", registerEntity.PresentCity);
                param[16] = new SqlParameter("@presentArea", registerEntity.PresentArea);
                param[17] = new SqlParameter("@pinCode", registerEntity.Pincode);
                param[18] = new SqlParameter("@employmentStatus", registerEntity.EmploymentStatus);
                param[19] = new SqlParameter("@jobType", registerEntity.JobType);
                param[20] = new SqlParameter("@clientSite", registerEntity.ClientSite);
                param[21] = new SqlParameter("@clientName", registerEntity.ClientName);
                param[22] = new SqlParameter("@panCardNo", registerEntity.PANCardNo);
                param[23] = new SqlParameter("@photoPath", registerEntity.PhotoPath);
                param[24] = new SqlParameter("@password", registerEntity.Password);

                param[26] = new SqlParameter("@setHrid", SqlDbType.VarChar, 500);
                param[26].Direction = ParameterDirection.Output;

                SqlHelper.ExecuteNonQuery(connection, CommandType.StoredProcedure, Constants.sp_AD_InsertHRRegisterDetails, param);
                string recruiterID = Convert.ToString(param[26].Value);

                if (string.IsNullOrEmpty(recruiterID))
                {
                    return null;
                }
                return recruiterID;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                connection.Close();
            }
        }
Esempio n. 10
0
        public void AltaAlumno(Entities.Alumno objeto)
        {
            try

            {
                Datos.AltaAlumno(objeto);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 11
0
 //==============Select========================
 /// <summary>
 /// SelectTheoDieuKien_GiaVon:
 /// - Select_GIAVON
 /// - Insert_GIAVON
 /// - Update_TheoMaKhoVaMaHangHoa_GIAVON
 /// - Delete_TheoMaKhoVaMaHangHoa_GIAVON
 /// </summary>
 /// <param name="thaotac"></param>
 /// <param name="set"></param>
 /// <param name="filter"></param>
 /// <returns></returns>
 public Entities.GiaVon[] SelectTheoDieuKien_GiaVon(string thaotac, Entities.GiaVon set, Entities.GiaVon filter)
 {
     Entities.GiaVon[] list = null;
     try
     {
         con = new Connection();
         cn = con.openConnection();
         cmd = new SqlCommand("exec sp_GiaVon @ThaoTac,@MaKho,@MaHangHoa,@SoLuong,@Gia,@MaKhok,@MaHangHoak,@SoLuongk,@Giak", cn);
         cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = thaotac;
         //set
         cmd.Parameters.Add("MaKho", SqlDbType.NVarChar).Value = set.MaKho;
         cmd.Parameters.Add("MaHangHoa", SqlDbType.NVarChar).Value = set.MaHangHoa;
         cmd.Parameters.Add("SoLuong", SqlDbType.NVarChar).Value = set.SoLuong;
         cmd.Parameters.Add("Gia", SqlDbType.NVarChar).Value = set.Gia;
         //filter
         cmd.Parameters.Add("MaKhok", SqlDbType.NVarChar).Value = filter.MaKho;
         cmd.Parameters.Add("MaHangHoak", SqlDbType.NVarChar).Value = filter.MaHangHoa;
         cmd.Parameters.Add("SoLuongk", SqlDbType.NVarChar).Value = filter.SoLuong;
         cmd.Parameters.Add("Giak", SqlDbType.NVarChar).Value = filter.Gia;
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         arr = new ArrayList();
         while (dr.Read())
         {
             int sl;
             float g;
             Entities.GiaVon row = new Entities.GiaVon
                                       {
                                           MaKho = dr["MaKho"].ToString(),
                                           MaHangHoa = dr["MaHangHoa"].ToString(),
                                           SoLuong = int.TryParse(dr["SoLuong"].ToString(), out sl) ? sl : 0,
                                           Gia = float.TryParse(dr["Gia"].ToString(), out g) ? g : 0
                                       };
             arr.Add(row);
         }
         int n = arr.Count;
         if (n == 0) list = null;
         list = new Entities.GiaVon[n];
         for (int i = 0; i < n; i++)
         {
             list[i] = (Entities.GiaVon)arr[i];
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); list = null; }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         con.closeConnection();
     }
     return list;
 }
 //==============Select========================
 public Entities.DiemThuongKhachHang[] SelectDiemThuongKhachHang(Entities.DiemThuongKhachHang input)
 {
     Entities.DiemThuongKhachHang[] list = null;
     try
     {
         con = new Connection();
         cn = con.openConnection();
         cmd = new SqlCommand("exec sp_DiemThuongKhachHang @ThaoTac,@MaDiemThuongKhachHang,@MaKhachHang,@TenKhachHang,@TongDiem,@DiemDaDung,@DiemConLai,@GhiChu,@Deleted", cn);
         cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = input.ThaoTac;
         //set
         cmd.Parameters.Add("MaDiemThuongKhachHang", SqlDbType.VarChar).Value = input.MaDiemThuongKhachHang;
         cmd.Parameters.Add("MaKhachHang", SqlDbType.VarChar).Value = input.MaKhachHang;
         cmd.Parameters.Add("TenKhachHang", SqlDbType.NVarChar).Value = input.TenKhachHang;
         cmd.Parameters.Add("TongDiem", SqlDbType.Int).Value = input.TongDiem;
         cmd.Parameters.Add("DiemDaDung", SqlDbType.Int).Value = input.DiemDaDung;
         cmd.Parameters.Add("DiemConLai", SqlDbType.Int).Value = input.DiemConLai;
         cmd.Parameters.Add("GhiChu", SqlDbType.NVarChar).Value = input.GhiChu;
         cmd.Parameters.Add("Deleted", SqlDbType.Bit).Value = input.Deleted;
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         arr = new ArrayList();
         while (dr.Read())
         {
             Entities.DiemThuongKhachHang row = new Entities.DiemThuongKhachHang();
             row.MaDiemThuongKhachHang = dr["MaDiemThuongKhachHang"].ToString();
             row.MaKhachHang = dr["MaKhachHang"].ToString();
             row.TenKhachHang = dr["TenKhachHang"].ToString();
             row.TongDiem = int.Parse(dr["TongDiem"].ToString());
             row.DiemDaDung = int.Parse(dr["DiemDaDung"].ToString());
             row.DiemConLai = int.Parse(dr["DiemConLai"].ToString());
             row.GhiChu = dr["GhiChu"].ToString();
             row.Deleted = bool.Parse(dr["Deleted"].ToString());
             arr.Add(row);
         }
         int n = arr.Count;
         if (n == 0) list = null;
         list = new Entities.DiemThuongKhachHang[n];
         for (int i = 0; i < n; i++)
         {
             list[i] = (Entities.DiemThuongKhachHang)arr[i];
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); list = null; }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         con.closeConnection();
     }
     return list;
 }
Esempio n. 13
0
 //==============Select========================
 public Entities.ChiTietTheGiamGia[] SelectChiTietTheGiamGia(Entities.ChiTietTheGiamGia input)
 {
     Entities.ChiTietTheGiamGia[] list = null;
     try
     {
         con = new Connection();
         cn = con.openConnection();
         cmd = new SqlCommand("exec sp_ChiTietTheGiamGia @ThaoTac,@MaTheGiamGia,@MaKhachHang,@TenKhachHang,@GiaTriThe,@NgayThu,@MaPhieuThu,@Deleted", cn);
         cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = input.ThaoTac;
         //set
         cmd.Parameters.Add("MaTheGiamGia", SqlDbType.VarChar).Value = input.MaTheGiamGia;
         cmd.Parameters.Add("MaKhachHang", SqlDbType.VarChar).Value = input.MaKhachHang;
         cmd.Parameters.Add("TenKhachHang", SqlDbType.NVarChar).Value = input.TenKhachHang;
         cmd.Parameters.Add("GiaTriThe", SqlDbType.Float).Value = input.GiaTriThe;
         cmd.Parameters.Add("NgayThu", SqlDbType.DateTime).Value = input.NgayThu;
         cmd.Parameters.Add("MaPhieuThu", SqlDbType.VarChar).Value = input.MaPhieuThu;
         cmd.Parameters.Add("Deleted", SqlDbType.Bit).Value = input.Deleted;
         dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         arr = new ArrayList();
         while (dr.Read())
         {
             Entities.ChiTietTheGiamGia row = new Entities.ChiTietTheGiamGia();
             row.MaTheGiamGia = dr["MaTheGiamGia"].ToString();
             row.MaKhachHang = dr["MaKhachHang"].ToString();
             row.TenKhachHang = dr["TenKhachHang"].ToString();
             row.GiaTriThe = float.Parse(dr["GiaTriThe"].ToString());
             row.NgayThu = DateTime.Parse(dr["NgayThu"].ToString());
             row.MaPhieuThu = dr["MaPhieuThu"].ToString();
             row.Deleted = bool.Parse(dr["Deleted"].ToString());
             arr.Add(row);
         }
         int n = arr.Count;
         if (n == 0) list = null;
         list = new Entities.ChiTietTheGiamGia[n];
         for (int i = 0; i < n; i++)
         {
             list[i] = (Entities.ChiTietTheGiamGia)arr[i];
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); list = null; }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         con.closeConnection();
     }
     return list;
 }
 public void UpdateMailsentDAL(Entities.HR.RecruiterRegisterEntity registerRecruiterEntity)
 {
     try
     {
         connection.Open();
         SqlParameter[] sparams = new SqlParameter[2];
         sparams[0] = new SqlParameter("@recruiterID", registerRecruiterEntity.Recruiterid);
         sparams[1] = new SqlParameter("@isMailsent", registerRecruiterEntity.IsMailSent);
         SqlHelper.ExecuteNonQuery(connection, CommandType.StoredProcedure, Constants.sp_HR_UpdateRecruiterIsMailSent, sparams);
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 15
0
        /// <summary>
        /// Delete
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public int Delete(Entities.KhuyenMaiSoLuong item)
        {
            int rt = 0;
            try
            {
                conn = new Connection();
                SqlConnection cn = conn.openConnection();
                string sql = "exec sp_DeleteKMSL @MaHangHoa";
                SqlCommand cmd = new SqlCommand(sql, cn);
                cmd.Parameters.Add("MaHangHoa", SqlDbType.VarChar, 50).Value = item.MaHangHoa;
                rt = cmd.ExecuteNonQuery();
            }
            catch
            {
                rt = 0;
            }

            return rt;
        }
Esempio n. 16
0
 public void BajaAlumno(Entities.Alumno Alumno)
 {
     try
     {
         conexion.Conectar();
         SqlCommand cmd = new SqlCommand("ELIMINAR_ALUMNO", conexion.Conectar());
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add("@id", SqlDbType.Int).Value = Alumno.id;
         cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         conexion.Desconectar();
     }
 }
Esempio n. 17
0
        public List<dataTree> getOpciones(string modulo)
        {
            List<dataTree> lt;
            using (ctx = new Entities())
            {

                lt = ctx.MENU.Where(t => t.MODULO == modulo && t.MENUID!=t.PADREID ).OrderBy(t=>t.POSICION).Select(t => new dataTree
                {
                    id = t.MENUID,
                    text = t.TITULO,
                    value = new valueTree { icono = t.ICONO, descripcion = t.DESCRIPCION, target = t.TARGET, url = t.URL, roles = t.ROLES },
                    parentid = t.MENUID == t.PADREID ? "-1" : t.PADREID,
                    roles = t.ROLES
                }
                ).ToList();
                lt=lt.Where(t=> (t.parentid == "-1") || (Roles.IsUserInRole(t.roles))).ToList();
            return lt;
            }
        }
Esempio n. 18
0
        public frmBaoCaoNhapHang(string hanhdong, string tennhanvien, Entities.ThongTinKiemKeKho[] row, Entities.KiemKeKho kiemke, Entities.ThongTinCongTy congty, string path)
        {
            InitializeComponent();
            try
            {
                GUI.Report.rptBaoCaoKiemKeKho report = new GUI.Report.rptBaoCaoKiemKeKho();
                report.SetDataSource(row);
                rptView.ReportSource = report;
                report.SetParameterValue("TenCongTy", congty.TenCongTy);
                report.SetParameterValue("DiaChiCongTy", congty.DiaChi);
                report.SetParameterValue("DienThoai", congty.SoDienThoai);
                report.SetParameterValue("FaxCongTy", congty.Fax);
                report.SetParameterValue("Web", congty.Website);
                report.SetParameterValue("Email", congty.Email);
                report.SetParameterValue("TenBaoCao", kiemke.Hanhdong);
                report.SetParameterValue("MaNhanVien", tennhanvien);
                report.SetParameterValue("MaKiemKe", kiemke.MaKiemKe);
                report.SetParameterValue("NgayKiemKe", kiemke.NgayKiemKe.ToString("dd/MM/yyyy"));
                report.SetParameterValue("MaKho", kiemke.Tenkho);
                report.SetParameterValue("TongTien", kiemke.GhiChu);

                if (hanhdong == "In")
                {
                    rptView.Show();
                }
                else if (hanhdong == "Excel")
                {
                    new GUI.Report.ExportCrystalReport().Export(report, path, Report.ExportCrystalReport.TypeBC.Excel);
                }
                else if (hanhdong == "Word")
                {
                    new GUI.Report.ExportCrystalReport().Export(report, path, Report.ExportCrystalReport.TypeBC.WordForWindows);
                }
                else if (hanhdong == "PDF")
                {
                    new GUI.Report.ExportCrystalReport().Export(report, path, Report.ExportCrystalReport.TypeBC.PortableDocFormat);
                }
            }
            catch
            {
            }
        }
Esempio n. 19
0
        public void CreateSign(Entities.SignTo newSign)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            SignTable _sign;

            /*создание объекта добавляемой строки*/
            _sign = new SignTable
            {
                NameSign = newSign.NameSign
            };
            // Вставка данных
            db.SignTable.InsertOnSubmit(_sign);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 20
0
        public void CreateType(Entities.TypeTo newType)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            TypeTable _type;

            /*создание объекта добавляемой строки*/
            _type = new TypeTable
            {
                NameType = newType.NameType
            };
            // Вставка данных
            db.TypeTable.InsertOnSubmit(_type);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 21
0
        public void Create(Entities.PolnayaPrimenyaemostTo newPolnayaPrimenyaemost)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            PolnayaPrimenyaemost _polnayaPrimenyaemost;

            /*создание объекта добавляемой строки*/
            _polnayaPrimenyaemost = new PolnayaPrimenyaemost
            {
                Count = newPolnayaPrimenyaemost.count,
                detalCode = newPolnayaPrimenyaemost.idDetali
            };
            // Вставка данных
            db.PolnayaPrimenyaemost.InsertOnSubmit(_polnayaPrimenyaemost);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 22
0
        public void CreateUnit(Entities.UnitTo newUnit)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            UnitTable _unit;

            /*создание объекта добавляемой строки*/
            _unit = new UnitTable
            {
                NameUnit = newUnit.NameUnit,
                ShortNameUnit = newUnit.ShortNameUnit
            };
            // Вставка данных
            db.UnitTable.InsertOnSubmit(_unit);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
 public static void InsertarDT(DataTable tabla, Entities.Articulos entidad)
 {
     DataRowCollection cfilas = tabla.Rows;
     DataRow nuevaFila;
     try
     {
         nuevaFila = tabla.NewRow();
         nuevaFila[0] = entidad.IdArticulo.ToString();
         nuevaFila[1] = entidad.IdItem.ToString();
         nuevaFila[2] = entidad.IdGenero.ToString();
         nuevaFila[3] = entidad.IdColor;
         nuevaFila[4] = entidad.Talle.ToString();
         nuevaFila[5] = entidad.IdProveedor.ToString();
         nuevaFila[6] = entidad.Descripcion.ToString();
         nuevaFila[7] = entidad.DescripcionWeb.ToString();
         nuevaFila[8] = entidad.PrecioCosto.ToString();
         nuevaFila[9] = entidad.PrecioPublico.ToString();
         nuevaFila[10] = entidad.PrecioMayor.ToString();
         nuevaFila[11] = entidad.Fecha;
         nuevaFila[12] = entidad.Imagen.ToString();
         nuevaFila[13] = entidad.ImagenBack.ToString();
         nuevaFila[14] = entidad.ImagenColor.ToString();
       //  nuevaFila[15] = entidad.ActivoWeb;
         nuevaFila[16] = entidad.NuevoWeb;
         nuevaFila[17] = entidad.Proveedor;
         nuevaFila[18] = entidad.IdAlicuota;
         cfilas.Add(nuevaFila);
     }
     catch (ConstraintException)
     {
         MessageBox.Show("El artículo '" + entidad.IdArticulo.ToString() + " " + entidad.Descripcion.ToString() + "' ya existe. No se creó el artículo.",
             "NcSoft",
             MessageBoxButtons.OK,
             MessageBoxIcon.Exclamation,
             MessageBoxDefaultButton.Button1);
     }
 }
Esempio n. 24
0
        public ByARpt CancelarPago(decimal ID_LIQ)
        {
            using (ctx = new Entities())
            {
                try
                {
                    ByARpt res = new ByARpt();
                    SL_LIQESTAMPILLAS liquidacion = ctx.SL_LIQESTAMPILLAS.Where(t => t.ID == ID_LIQ).FirstOrDefault();
                    if (liquidacion != null)
                    {
                        liquidacion.ESTADO = "LI";

                        SL_PAGOS Pago = ctx.SL_PAGOS.Where(t => t.ID_LIQ == ID_LIQ && t.ESTADO == "AC").OrderByDescending(t => t.FEC_REG).FirstOrDefault();
                        Pago.ESTADO = "IN";

                        ctx.SaveChanges();
                        res.Mensaje = "Operación Realizada Satisfactoriamente";
                        res.Error = false;
                        return res;
                    }
                    else
                    {
                        res.Mensaje = "No se encuentra liquidación";
                        res.Error = true;
                        return res;
                    }
                }
                catch
                {
                    ByARpt res = new ByARpt();
                    res.Mensaje = "Ha ocurrido un error...";
                    res.Error = true;
                    return res;
                }
            }
        }
Esempio n. 25
0
        public void CreateMaterial(Entities.MaterialTo newMaterial)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            MaterialTable _material;

            /*создание объекта добавляемой строки*/
            _material = new MaterialTable
            {
                MaterialCode = newMaterial.MaterialCode,
                NameMaterial = newMaterial.NameMaterial,
                UnitCode = newMaterial.UnitCode
            };
            // Вставка данных
            db.MaterialTable.InsertOnSubmit(_material);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Esempio n. 26
0
 /// <summary>
 /// Dal layer method to store  feedback data in database
 /// </summary>
 /// <param name="feedbackEntity">Object for inserting data into database</param>
 /// <returns>System.Int32</returns>
 public int FeedbackDAL(Entities.FeedbackEntity feedbackEntity)
 {
     int result = 0;
     try
     {
         connection.Open();
         SqlCommand cmd = new SqlCommand();
         SqlParameter[] sqlparams = {
                                      new SqlParameter("@Name ",feedbackEntity.Name),
                                      new SqlParameter("@Subject",feedbackEntity.Subject),
                                      new SqlParameter("@Feedback ",feedbackEntity.Feedback)
                                     };
         result = SqlHelper.ExecuteNonQuery(connection, CommandType.StoredProcedure, Constants.sp_JS_Insertfeedback);
     }
     catch (Exception)
     {
         // throw ;
     }
     finally
     {
         connection.Close();
     }
     return result;
 }
Esempio n. 27
0
        public void AltaAlumno(Entities.Alumno Alumno)
        {
            try
            {
                conexion.Conectar();

                SqlCommand cmd = new SqlCommand("INSERTAR_ALUMNO", conexion.Conectar());
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@legajo", SqlDbType.Int).Value = Alumno.legajo;
                cmd.Parameters.Add("@nombre", SqlDbType.NVarChar).Value = Alumno.nombre;
                cmd.Parameters.Add("@apellido", SqlDbType.NVarChar).Value = Alumno.apellido;
                cmd.Parameters.Add("@documento", SqlDbType.NVarChar).Value = Alumno.documento;
                cmd.ExecuteNonQuery();

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conexion.Desconectar();
            }
        }
Esempio n. 28
0
        public void Update(Entities.SostavIzdeliaTo updSostavIzdelia)
        {
            var db = new DBElectricDataContext();

            var query =
                from sostavIzdelia in db.SostavIzdelia
                where sostavIzdelia.Id == updSostavIzdelia.id
                select sostavIzdelia;

            foreach (SostavIzdelia sostavIzdelia in query)
            {
                sostavIzdelia.Count = updSostavIzdelia.count;
                sostavIzdelia.IdCurrent = updSostavIzdelia.idCurrent;
                sostavIzdelia.IdIzdelia = updSostavIzdelia.idIzdelia;
                sostavIzdelia.IdLast = updSostavIzdelia.idLast;
            }

            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 29
0
        public void UpdateMaterial(Entities.MaterialTo newMaterial)
        {
            var db = new DBElectricDataContext();

            var query =
                from material in db.MaterialTable
                where material.MaterialCode == newMaterial.MaterialCode
                select material;

            foreach (MaterialTable material in query)
            {
                material.NameMaterial = newMaterial.NameMaterial;
                material.UnitCode = newMaterial.UnitCode;
            }

            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 30
0
        public void UpdateDirectory(Entities.DirectoryTo newDirectory)
        {
            var db = new DBElectricDataContext();

            var query =
                from directory in db.DirectoryTable
                where directory.ProductionCode == newDirectory.ProductionCode
                select directory;

            foreach (DirectoryTable directory in query)
            {
                directory.NormMaterial = newDirectory.NormMaterial;
                directory.NormWaste = newDirectory.NormWaste;
                directory.MaterialCode = newDirectory.MaterialCode;
            }

            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 31
0
 /// <summary>
 /// 提交保存,持久化到数据库
 /// </summary>
 /// <param name="db">实体数据</param>
 /// <returns>受影响行数</returns>
 public int Save(Entities db)
 {
     return(db.SaveChanges());
 }
Esempio n. 32
0
 /// <summary>
 /// 获取所有
 /// </summary>
 /// <returns>集合</returns>
 public virtual IQueryable <T> GetAll(Entities db)
 {
     return(db.Set <T>().AsQueryable());
 }
Esempio n. 33
0
 public Base()
 {
     _db = new Entities();
     Set = _db.Set <T>();
 }