Beispiel #1
0
        public List <EmpRptDL> FillEmployeeBySerialAndRoleWithPara(string Company_Id, string Branch_Id, decimal EmpSerialNo, string wherestr)
        {
            StackFrame stackFrame = new StackFrame();
            MethodBase methodBase = stackFrame.GetMethod();

            List <EmpRptDL> objectList = new List <EmpRptDL>();;

            try
            {
                OpenEntityConnection();


                object[] param1 =
                {
                    new SqlParameter("@Company_Id",  Company_Id),
                    new SqlParameter("@Branch_Id",   Branch_Id),
                    new SqlParameter("@EmpSerialNo", EmpSerialNo),
                    new SqlParameter("@wherestr",    wherestr)
                };

                var objlist = objPharmaEntities.Database.SqlQuery <EmpRptDL>("exec dbo._SpFillEmployeeBySerialAndRoleWithPara @Company_Id,@Branch_Id,@EmpSerialNo,@wherestr", param1).ToList();

                if (objlist != null)
                {
                    foreach (var obj in objlist)
                    {
                        EmpRptDL objCombDL = new EmpRptDL();
                        objCombDL.Id             = Convert.ToString(obj.Id);
                        objCombDL.Name           = obj.Name;
                        objCombDL.FullNameArabic = obj.FullNameArabic;
                        objectList.Add(objCombDL);
                    }
                }
            }
            catch (Exception ex)
            {
                catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(),
                                      this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString());
                objectList = null;
                throw ex;
            }
            finally
            {
                CloseEntityConnection();
            }

            return(objectList);
        }
Beispiel #2
0
        public List <EmpRptDL> FillEmployeeBySerialAndRoleWithShow(string Company_Id, string Branch_Id, decimal EmpSerialNo)
        {
            StackFrame stackFrame = new StackFrame();
            MethodBase methodBase = stackFrame.GetMethod();

            List <EmpRptDL> objectList = new List <EmpRptDL>();;

            try
            {
                OpenEntityConnection();


                object[] param1 =
                {
                    new SqlParameter("@Company_Id",  Company_Id),
                    new SqlParameter("@Branch_Id",   Branch_Id),
                    new SqlParameter("@EmpSerialNo", EmpSerialNo)
                };

                //               object[] params = {
                //                new SqlParameter("@ParametterWithNummvalue", DBNull.Value),
                //                new SqlParameter("@In_Parameter", "Value"),
                //                new SqlParameter("@Out_Parameter", SqlDbType.INT)
                //{Direction = ParameterDirection.Output}};

                //            YourDbContext.Database.ExecuteSqlCommand("exec StoreProcedure_Name @ParametterWithNummvalue, @In_Parameter, @Out_Parameter", params);
                //            YourDbContext.SaveChanges();

                //Var ReturnValue = ((SqlParameter)params[2]).Value


                var objlist = objPharmaEntities.Database.SqlQuery <EmpRptDL>("exec dbo._SpFillEmployeeBySerialAndRoleWithShow @Company_Id,@Branch_Id,@EmpSerialNo", param1).ToList();

                //var objlist = objPharmaEntities.Database.ExecuteSqlCommand("exec dbo.SP_GeneralAnyCombo @FldIdName,@FldName,@TblName,@Strwhere", param1);

                if (objlist != null)
                {
                    foreach (var obj in objlist)
                    {
                        EmpRptDL objCombDL = new EmpRptDL();
                        objCombDL.Id             = Convert.ToString(obj.Id);
                        objCombDL.Name           = obj.Name;
                        objCombDL.FullNameArabic = obj.FullNameArabic;
                        objectList.Add(objCombDL);
                    }
                }
            }
            catch (Exception ex)
            {
                catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(),
                                      this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString());
                objectList = null;
                throw ex;
            }
            finally
            {
                CloseEntityConnection();
            }

            return(objectList);
        }