Ejemplo n.º 1
0
 private Object darDeAltaRol()
 {
     SQLManager sqlManager = new SQLManager();
     return sqlManager.generarSP("AltaRol").
            agregarStringSP("@Nombre", txtNombre.Text).
            agregarListaSP("@Funcionalidades", funcionalidadesActuales()).
            ejecutarSP();
 }
        public GameManager(ScreenManager screenManager, ContentManager Content)
        {
            this.ScreenManager = screenManager;
            this.GraphicsDevice = screenManager.GraphicsDevice;
            this.Content = Content;
            this.random = new Random();

            // Hacks.
            sql = new SQLManager();
            //sql.CreateNewDatabase();

            // More Hacks.
            //playerData = SaveManager.LoadData();
            //SaveManager.SaveData(PlayerData);
        }
Ejemplo n.º 3
0
        // Realiza el llamado al sp para registrar al usuario efectivamente, si es que no hubo errores
        // encripta la contraseña antes de enviarla
        private void registrarUsuario()
        {
            SQLManager manager = new SQLManager().generarSP("RegistrarUsuario")
                                                 .agregarStringSP("@Usuario", txtUsuario)
                                                 .agregarStringSP("@Contrasenia", Encriptador.encriptarSegunSHA256(txtPassword.Text));

            try
            {
                manager.ejecutarSP();
                MessageBox.Show("El usuario " + txtUsuario.Text + " ha sido registrado de forma correcta", "Registro exitoso", MessageBoxButtons.OK);
                this.Close();
            }
            catch(Exception e)
            {
                MessageBox.Show(e.Message, "Error en el registro", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 4
0
        // Realiza la cancelación de pasajes
        private void botonCancelar_Click(object sender, EventArgs e)
        {
            SQLManager manager = new SQLManager().generarSP("CancelarPasajesEncomiendasAeronave")
                                                 .agregarStringSP("@Matricula", matricula)
                                                 .agregarFechaSP("@FechaBaja", fechaBaja);

            if(llamadoDesdeBajaLogica){
                manager = manager.agregarFechaNula("@FechaReinicio");
            }
            else{
                manager = manager.agregarFechaSP("@FechaReinicio",fechaReinicio);
            }

            manager.ejecutarSP();

            this.Close();
        }
Ejemplo n.º 5
0
        public void darDeBajaLogica(DateTime fechaBaja)
        {
            string matricula = dg.Rows[indiceAeronaveElegida].Cells["Matrícula"].Value.ToString();
            SQLManager manager = new SQLManager();

            manager = manager.generarSP("DarDeBajaLogica").agregarStringSP("@Matricula", matricula)
                                                          .agregarFechaSP("@FechaBaja", fechaBaja);
            try
            {
                manager.ejecutarSP();
                MessageBox.Show("La fecha de baja de la aeronave fue cargada exitosamente", "Baja de aeronave", MessageBoxButtons.OK);
            }
            catch (Exception e)
            {
                if (e.Message.Contains("fuera de servicio"))
                {
                    MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK);
                    return;
                }
                new Form7(e.Message, matricula, true, fechaBaja, Program.fechaHoy()).ShowDialog();
            }
        }
Ejemplo n.º 6
0
        public void dejarFueraDeServicio(DateTime fechaReinicio, DateTime fechaBaja)
        {
            string matricula = dg.Rows[indiceAeronaveElegida].Cells["Matrícula"].Value.ToString();
            SQLManager manager = new SQLManager();

            manager = manager.generarSP("DejarAeronaveFueraDeServicio").agregarStringSP("@Matricula", matricula)
                                                                       .agregarFechaSP("@FechaBaja", fechaBaja)
                                                                       .agregarFechaSP("@FechaReinicio", fechaReinicio);
            try
            {
                manager.ejecutarSP();
                MessageBox.Show("El período de fuera de servicio se ha cargado exitosamente", "Fuera de servicio", MessageBoxButtons.OK);
            }
            catch (Exception e)
            {
                if (e.Message.Contains("fuera de servicio"))
                {
                    MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK);
                    return;
                }
                new Form7(e.Message, matricula,false, fechaBaja, fechaReinicio).ShowDialog();
            }
        }
Ejemplo n.º 7
0
    void Update()
    {
        Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
        if (mGetLcalTime > 0)
        {
            Debug.Log("mGetLcalTime  = " + mGetLcalTime + " isGetlocalBegin=" + isGetlocalBegin + " isGetlocaled=" + isGetlocaled);
        }

        if (isGetlocalBegin && !isGetlocaled)
        {
            mGetLcalTime += Time.deltaTime;
            if (mGetLcalTime >= 10)
            {
                isGetlocaled = true;
                GameManager.getIntance().mInitStatus = 8;
            }
            return;
        }
        Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
        if (mLoadingDec == null)
        {
            mLoadingDec = GameObject.Find("game_begin_loading_des").GetComponent <Text>();
        }
        if (GameManager.getIntance().mInitStatus < 11)
        {
            mLoadingDec.text = GameManager.getIntance().mInitDec;
        }
        if (GameManager.getIntance().mInitStatus == -1)
        {
            return;
        }
        else if (GameManager.getIntance().mInitStatus == 10)
        {
            GameManager.getIntance().mInitDec = "";
            mLoadingDec.text = GameManager.getIntance().mInitDec;
            GameManager.getIntance().mInitStatus = 11;
            Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
            if (SQLHelper.getIntance().isFristStartGame == -1)
            {
                SQLHelper.getIntance().updateVersionCode(GameManager.mVersionCode);
                Destroy(GameObject.Find("game_begin_loading"));
                GetComponentInChildren <TypewriterEffect>().init(JsonUtils.getIntance().getStringById(100001));
            }
            else
            {
                AudioSource source = GameObject.Find("information").GetComponent <AudioSource>();
                GameManager.getIntance().playBgm(source, "Sounds/关卡背景音");
                Destroy(gameObject);
                GameObject.Find("Manager").GetComponent <LevelManager>().init();
            }
        }
        else if (GameManager.getIntance().mInitStatus == 0)
        {
            GameManager.getIntance().mInitDec    = "开始配置文件初始化";
            GameManager.getIntance().mInitStatus = 1;
            Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
#if UNITY_ANDROID || UNITY_IOS
            SQLManager.getIntance().initPathRoot();
            SQLManager.getIntance().alterTableByVersion();
            Thread th1 = new Thread(() =>
            {
                JsonUtils.getIntance().initBefore();
                JsonUtils.getIntance().init();
                GameManager.getIntance().mInitStatus = 2;
            });
            th1.Start();
#endif
#if UNITY_STANDALONE
            SQLManager.getIntance().init(sqlName, tabName);
            SQLManager.getIntance().alterTableByVersion();
            //  GameManager.getIntance().mInitStatus = 8;
            Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
            JsonUtils.getIntance().initBefore();
            JsonUtils.getIntance().init();

            GameManager.getIntance().mInitStatus = 2;
#endif
        }
        else if (GameManager.getIntance().mInitStatus == 2)
        {
            GameManager.getIntance().mInitDec    = JsonUtils.getIntance().getStringById(100025);
            GameManager.getIntance().mInitStatus = 3;
            Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
#if UNITY_ANDROID || UNITY_IOS
            Thread th1 = new Thread(() =>
            {
                try
                {
                    isUpdate = SQLManager.getIntance().initNoNet();
                    Debug.Log("isUpdate = " + isUpdate);
                    SQLManager.getIntance().startThread();
                    if (isUpdate == 1)
                    {
                        GameManager.getIntance().mInitStatus = 4;
                        Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
                    }
                    else if (isUpdate == 2)
                    {
                        GameManager.getIntance().mInitStatus = 6;
                        Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
                    }
                    else if (isUpdate == 3)
                    {
                        GameManager.getIntance().mInitStatus = 6;
                        Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
                    }
                }
                catch (System.Exception e)
                {
                    Debug.Log("处理存档出错");
                    Debug.Log(e.Message);
                }
            });
            th1.Start();
#endif
#if UNITY_STANDALONE
            GameManager.getIntance().mInitStatus = 8;
            Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
#endif
        }
        else if (GameManager.getIntance().mInitStatus == 4)//强制轮回
        {
            GameManager.getIntance().mInitDec    = JsonUtils.getIntance().getStringById(100029);
            GameManager.getIntance().mInitStatus = 5;
            Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
            GameObject.Find("lunhui_tips").GetComponent <LuiHuiTips>().showUi(JsonUtils.getIntance().getStringById(100002),
                                                                              LuiHuiTips.TYPPE_RETURN_START);
            GameObject.Find("lunhui_tips").GetComponent <LuiHuiTips>().showSelf();
        }
        else if (GameManager.getIntance().mInitStatus == 6)//和网络同步数据
        {
            GameManager.getIntance().mInitStatus = 7;
            Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
            Debug.Log(" SQLManager.getIntance().isUpdateed()  = " + SQLManager.getIntance().isUpdateed());
            Debug.Log(" Application.internetReachability == NetworkReachability.NotReachable  = " + (Application.internetReachability == NetworkReachability.NotReachable));
            if (!SQLManager.getIntance().isUpdateed() || Application.internetReachability == NetworkReachability.NotReachable || GameManager.isTestVersion)
            {
                GameManager.getIntance().mInitStatus = 8;
                Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
                return;
            }



            if (!isGetlocalBegin && !isGetlocaled)
            {
                isGetlocalBegin = true;
                Thread th1 = new Thread(() =>
                {
                    if (!NetServer.getIntance().getLocl(null, false, false))
                    {
                        GameManager.getIntance().mInitStatus = 8;
                        isGetlocaled = true;
                        Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
                    }
                    else
                    {
                        GameManager.getIntance().mInitStatus = 6;
                        isGetlocaled = true;
                        Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
                    }
                });
                th1.Start();
                return;
            }
            isUpdateEnd = true;
            bool isHaveNet = NetServer.getIntance().isHaveLocal();
            Debug.Log("NetServer.getIntance().getLocal() isUpdate =" + isUpdate);
            if (isHaveNet)
            {
                if (isUpdate == 3)
                {
                    Thread th1 = new Thread(() =>
                    {
                        Debug.Log("NetServer.getIntance().getLocal();");
                        string local = NetServer.getIntance().getLocal();
                        Debug.Log(" NetServer.getIntance().getLocal()");
                        SQLManager.getIntance().saveLocal(local);
                        Debug.Log(" SQLHelper.getIntance().saveLoacl(local);");
                        GameManager.getIntance().mInitStatus = 8;
                        Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
                    });
                    th1.Start();
                }
                else if (isUpdate == 2 || isUpdate == 1)
                {
                    GameObject.Find("lunhui_tips").GetComponent <LuiHuiTips>().showUi("检测到服务端有您的存档,需要进行同步吗", LuiHuiTips.TYPPE_UPDATE_LINE);
                    GameObject.Find("lunhui_tips").GetComponent <LuiHuiTips>().showSelf();
                    //UiControlManager.getIntance().show(UiControlManager.TYPE_LUIHUI);
                }
            }
            else
            {
                GameManager.getIntance().mInitStatus = 8;
                Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
            }
        }
        else if (GameManager.getIntance().mInitStatus == 8)
        {
            GameManager.getIntance().mInitStatus = 9;
            Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
            GameManager.getIntance().mInitDec = JsonUtils.getIntance().getStringById(100030);
#if UNITY_ANDROID || UNITY_IOS
            Thread th1 = new Thread(() =>
            {
                if (isUpdateEnd)
                {
                    Debug.Log(" SQLHelper.getIntance().updateIsUpdate(); ");
                    SQLHelper.getIntance().updateIsUpdate();
                    Debug.Log(" SQLHelper.getIntance().updateIsUpdate(); end");
                }
                Debug.Log("SQLHelper.getIntance().init();");
                SQLHelper.getIntance().init();

                int count = 0;
                if (SQLHelper.getIntance().mVocationCount == 0)
                {
                    for (int i = 0; ; i++)
                    {
                        if (SQLHelper.getIntance().mPlayVocation.ContainsKey(i))
                        {
                            count++;
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (count != 0)
                    {
                        SQLHelper.getIntance().updateVocationCount(count);
                    }
                }

                Debug.Log("SQLHelper.getIntance().init(); end");
                GameManager.getIntance().mInitStatus = 10;
                Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
            });
            th1.Start();
#endif

#if UNITY_STANDALONE
            SQLHelper.getIntance().init();
            int count = 0;
            if (SQLHelper.getIntance().mVocationCount == 0)
            {
                for (int i = 0; ; i++)
                {
                    if (SQLHelper.getIntance().mPlayVocation.ContainsKey(i))
                    {
                        count++;
                    }
                    else
                    {
                        break;
                    }
                }
                if (count != 0)
                {
                    SQLHelper.getIntance().updateVocationCount(count);
                }
            }
            GameManager.getIntance().mInitStatus = 10;
            Debug.Log(" GameManager.getIntance().mInitStatus = " + GameManager.getIntance().mInitStatus);
#endif
        }
    }
Ejemplo n.º 8
0
        //SAVE
        public static string CU_Mst_Item(M_AT_Mst_ItemMasterBO ObjItem)
        {
            M_AT_Mst_ItemMasterBO ObjBOAT_Item = new M_AT_Mst_ItemMasterBO();
            string    strRetMst        = "";
            DataTable dt               = new DataTable();
            string    var_ErrorMessage = "";

            try
            {
                if (ObjItem.Item_Name.Length == 0)
                {
                    var_ErrorMessage = var_ErrorMessage + "Item Name Cannot Be Blank \n";
                }

                if (SQLManager.CheckDuplicateRecord("M_AT_Mst_ItemMaster", "MItem_ID", Convert.ToInt32("0" + ObjItem.MItem_ID), "Item_Name", ObjItem.Item_Name,
                                                    " AND  Fk_Company_ID=" + ObjItem.Fk_Company_ID + " AND  Fk_Branch_ID=" + ObjItem.Fk_Branch_ID))
                {
                    var_ErrorMessage = var_ErrorMessage + "Item Already Exist. \n";
                }
                if (SQLManager.CheckDuplicateRecord("M_AT_Mst_ItemMaster", "MItem_ID", Convert.ToInt32("0" + ObjItem.MItem_ID), "HSNCode", ObjItem.HSNCode,
                                                    " AND  Fk_Company_ID=" + ObjItem.Fk_Company_ID + " AND  Fk_Branch_ID=" + ObjItem.Fk_Branch_ID))
                {
                    var_ErrorMessage = var_ErrorMessage + "Item Already Exist. \n";
                }
                if (ObjItem.Fk_UOM_ID <= 0)
                {
                    var_ErrorMessage = var_ErrorMessage + "Select Unit Of Measurment \n";
                }

                if (ObjItem.Item_Tax_GST_ID <= 0)
                {
                    var_ErrorMessage = var_ErrorMessage + "Select Integrated Tax Rate\n";
                }

                if (ObjItem.Item_Tax_GST_Effective_From.Length != 11)
                {
                    var_ErrorMessage = var_ErrorMessage + "Invalid Integrated Tax Rate Effective From Date\n";
                }

                if (ObjItem.Item_Code.Length == 0)
                {
                    var_ErrorMessage = var_ErrorMessage + "Invalid Item Code \n";
                }

                if (var_ErrorMessage.Length == 0)
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        if (Convert.ToInt32(ObjItem.MItem_ID) == 0)
                        {
                            ObjBOAT_Item.Fk_Company_ID              = ObjItem.Fk_Company_ID;
                            ObjBOAT_Item.Fk_Branch_ID               = ObjItem.Fk_Branch_ID;
                            ObjBOAT_Item.Fk_Year_ID                 = ObjItem.Fk_Year_ID;
                            ObjBOAT_Item.MDBSC_RowCreatedByUser_ID  = ObjItem.MDBSC_RowCreatedByUser_ID;
                            ObjBOAT_Item.MDBSC_RowCreatedByUserName = ObjItem.MDBSC_RowCreatedByUserName;
                            ObjBOAT_Item.Item_SRNO = 0;
                            ObjBOAT_Item.Fk_MIC_ID = 1;
                            ObjBOAT_Item.Fk_IG_ID  = 1;
                            ObjBOAT_Item.Fk_ISG_ID = 1;
                            ObjBOAT_Item.Item_Code = MEF.GenrateRefNo(ObjItem.Fk_Company_ID, ObjItem.Fk_Branch_ID, 0, "Item", "I-", "I-", "No", "", "", "", 0);
                        }


                        ObjBOAT_Item.MItem_ID        = ObjItem.MItem_ID;
                        ObjBOAT_Item.Item_Type       = ObjItem.Item_Type;
                        ObjBOAT_Item.Fk_UOM_ID       = ObjItem.Fk_UOM_ID;
                        ObjBOAT_Item.Item_Name       = ObjItem.Item_Name;
                        ObjBOAT_Item.HSNCode         = ObjItem.HSNCode;
                        ObjBOAT_Item.Fk_HSN_ID       = ObjItem.Fk_HSN_ID;
                        ObjBOAT_Item.HSN_Desc        = ObjItem.HSN_Desc;
                        ObjBOAT_Item.Item_Tax_GST_ID = ObjItem.Item_Tax_GST_ID;
                        //decimal var_Tax_GST_Rate = Convert.ToDecimal(Item_Tax_GST_ID.SelectedItem.Text);
                        //decimal var_Tax_SGST_Rate = Math.Round((var_Tax_GST_Rate / 2), 2);
                        ObjBOAT_Item.Item_CGST_Rate = ObjItem.Item_CGST_Rate;
                        ObjBOAT_Item.Item_SGST_Rate = ObjItem.Item_SGST_Rate;
                        ObjBOAT_Item.Item_IGST_Rate = ObjItem.Item_IGST_Rate;

                        if (ObjItem.Item_Tax_GST_Effective_From.Length == 11)
                        {
                            ObjBOAT_Item.Item_Tax_GST_Effective_From = ObjItem.Item_Tax_GST_Effective_From;
                        }

                        ObjBOAT_Item.Item_CESS_Rate          = ObjItem.Item_CESS_Rate;
                        ObjBOAT_Item.Item_Tax_CESS_ID        = ObjItem.Item_Tax_CESS_ID;
                        ObjBOAT_Item.Item_Selling_Rate       = ObjItem.Item_Selling_Rate;
                        ObjBOAT_Item.Item_Purchase_Rate      = ObjItem.Item_Purchase_Rate;
                        ObjBOAT_Item.Item_Desc               = ObjItem.Item_Desc;
                        ObjBOAT_Item.MDBSC_RowStatus         = ObjItem.MDBSC_RowStatus;
                        ObjBOAT_Item.MDBSC_RowLupdnByUser_ID = ObjItem.MDBSC_RowLupdnByUser_ID;
                        ObjBOAT_Item.MDBSC_RowLupdnUserName  = ObjItem.MDBSC_RowLupdnUserName;
                        ObjBOAT_Item.MDBSC_RowLupdnOn_DT     = DateHelper.ConvertToDataBase(DateHelper.ConvertToForm(DateTime.Now));
                        var_ErrorMessage = ObjBOAT_Item.Insert_Update(ObjBOAT_Item);
                        //ObjItem.MItem_ID =Convert.ToInt64( var_ErrorMessage.Substring((var_ErrorMessage.IndexOf("|") + 1), (var_ErrorMessage.Length - var_ErrorMessage.IndexOf("|") - 1)));
                        //var_ErrorMessage = var_ErrorMessage.Substring((0), (var_ErrorMessage.IndexOf("|")));
                        scope.Complete();
                    }
                    strRetMst = var_ErrorMessage;
                }
                else
                {
                    strRetMst = var_ErrorMessage + "|" + ObjItem.MItem_ID.ToString();
                }


                return(strRetMst);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 9
0
    /// <summary>
    /// 업적을 갱신합니다. (현재 수치와 커트라인을 비교).
    /// </summary>
    /// <param name="AUID"></param>
    /// <param name="AchievementCode1"></param>
    /// <param name="AchievementCode2">여러 개를 갱신할 때 입력.</param>
    /// <param name="AchievementCode3">여러 개를 갱신할 때 입력.</param>
    static public void UpdateAchievementWithNewValue(int AUID, int newValue, string AchievementCode1, string AchievementCode2 = null, string AchievementCode3 = null, string AchievementCode4 = null, string AchievementCode5 = null)
    {
        int maxAchievement = 5;

        string[] AchievementCode = new string[maxAchievement];
        int[]    oldCount        = new int[maxAchievement];
        int[]    newCount        = new int[maxAchievement];
        int[]    cutLine         = new int[maxAchievement];
        int[]    Complete        = new int[maxAchievement];
        int      index           = 0;

        string SQL = string.Format("select * from UserAchievement where AUID='{0}' and (AchievementCode='{1}' or AchievementCode='{2}' or AchievementCode='{3}' or AchievementCode='{4}' or AchievementCode='{5}')",
                                   AUID, AchievementCode1, AchievementCode2, AchievementCode3, AchievementCode4, AchievementCode5);
        SqlDataReader reader = SQLManager.ExecuteReader(SQL);

        CSVReader excel = null;

        if (reader.HasRows)
        {
            while (reader.Read())
            {
                AchievementCode[index] = reader["AchievementCode"].ToString();
                Complete[index]        = int.Parse(reader["Complete"].ToString());

                if (Complete[index] == 0)
                {
                    if (excel == null)
                    {
                        excel = new CSVReader("TbAchievement.txt");
                    }

                    oldCount[index] = int.Parse(reader["Count"].ToString());
                    newCount[index] = newValue;

                    cutLine[index] = int.Parse(ReadJSONData.ReadLine(excel.FindJSONData("AchievementCode", AchievementCode[index]))[3]);

                    Debug.Log(CodeManager.GetMethodName() + AUID + " : " + AchievementCode[index]);
                }

                index++;
            }
        }
        reader.Close();

        for (int i = 0; i < index; i++)
        {
            if (Complete[i] == 0)
            {
                if (newCount[i] >= cutLine[i])
                {
                    newCount[i] = cutLine[i];

                    SQL    = string.Format("update UserAchievement set Count='{0}', Complete='1' where AUID='{1}' and AchievementCode='{2}'", newCount[i], AUID, AchievementCode[i]);
                    reader = SQLManager.ExecuteReader(SQL);

                    reader.Close();

                    SQL    = string.Format("insert into UserAchievementCompleteNotice values ('{0}','{1}');", AUID, AchievementCode[i]);
                    reader = SQLManager.ExecuteReader(SQL);

                    reader.Close();

                    if (showLog)
                    {
                        Debug.Log(CodeManager.GetMethodName() + AUID + " : " + AchievementCode[i] + " 가 갱신되어서 커트라인을 달성했다.");
                    }
                }
                else
                {
                    SQL    = string.Format("update UserAchievement set Count='{0}' where AUID='{1}' and AchievementCode='{2}'", newCount[i], AUID, AchievementCode[i]);
                    reader = SQLManager.ExecuteReader(SQL);

                    reader.Close();

                    if (showLog)
                    {
                        Debug.Log(CodeManager.GetMethodName() + AUID + " : " + AchievementCode[i] + " 가 갱신되었다.");
                    }
                }
            }
            else
            {
                if (showLog)
                {
                    Debug.Log(CodeManager.GetMethodName() + AUID + " : " + AchievementCode[i] + " 는 이미 커트라인을 달성했다.");
                }
            }
        }
    }
Ejemplo n.º 10
0
 private Object modificarRuta()
 {
     SQLManager sqlManager = new SQLManager();
     return sqlManager.generarSP("ModificarRuta").agregarIntSP("@IdRuta", idRuta)
                                                 .agregarIntSP("@Codigo", txtCodigo)
                                                 .agregarListaSP("@Servicios", listaServicios)
                                                 .agregarStringSP("@CiudadOrigen", txtCiudadOrigenNueva)
                                                 .agregarStringSP("@CiudadDestino", txtCiudadDestinoNueva)
                                                 .agregarDecimalSP("@PrecioPasaje", enDecimal(txtPrecioPasajeNuevo.Text))
                                                 .agregarDecimalSP("@PrecioeEncomienda", enDecimal(txtPrecioEncomiendaNueva.Text))
                                                 .ejecutarSP();
 }
Ejemplo n.º 11
0
        private void createButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Candidate c = (Candidate)usersListView.SelectedItem;
                System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();

                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Document doc = new Document(PageSize.A4, 72, 72, 72, 72);
                    PdfWriter.GetInstance(doc, new FileStream(System.IO.Path.Combine(fbd.SelectedPath,
                                                                                     c.UserName + "_CTVIAT_Report.pdf"), FileMode.Create));
                    doc.Open();

                    Paragraph p1 = new Paragraph(c.UserName);
                    p1.Font.Size = 24;
                    p1.Font.SetStyle(Font.ITALIC);
                    doc.Add(p1);

                    ArrayList tests = SQLManager.getAllTestsOfCandidate(c.UserID);
                    if (tests.Count == 0)
                    {
                        doc.Add(new Paragraph("Candidate didn't solve any tests"));
                    }
                    else
                    {
                        int i = 1;
                        foreach (Test t in tests)
                        {
                            String testInfo = "TEST " + i + "\nTEST ID: " + t.TestID +
                                              "\nTEST SUBJECT: " + t.Subject + "\nTEST DATE: " + t.Date +
                                              "\nTEST TAKE ORDER: " + t.TakeOrder + "\nTEST TIME: ";

                            int time = t.Time;
                            if (time / 3600 > 0)
                            {
                                if (time / 3600 == 1)
                                {
                                    testInfo = testInfo + time / 3600 + " hour";
                                }
                                else
                                {
                                    testInfo = testInfo + time / 3600 + " hours";
                                }
                            }
                            if (time % 3600 / 60 > 0)
                            {
                                if (time % 3600 / 60 == 1)
                                {
                                    testInfo = testInfo + time % 3600 / 60 + " minute";
                                }
                                else
                                {
                                    testInfo = testInfo + time % 3600 / 60 + " minutes";
                                }
                            }
                            if (time % 60 == 1)
                            {
                                testInfo = testInfo + time % 60 + " second\n";
                            }
                            else
                            {
                                testInfo = testInfo + time % 60 + " seconds\n";
                            }

                            if (t.IsNew)
                            {
                                testInfo = testInfo + "TEST COMPLETENESS: COMPLETED\n";
                            }
                            else
                            {
                                testInfo = testInfo + "TEST COMPLETENESS: INCOMPLETED\nTEST START QUESTION NO: "
                                           + t.StartQuestionNo + "\n";
                            }

                            Paragraph p = new Paragraph(testInfo);
                            p.Font.SetStyle(Font.BOLD);
                            doc.Add(p);

                            foreach (Question q in t.Questions)
                            {
                                String questionInfo = "QUESTION\n" + q.QuestionText + "\nCANDIDATE ANSWER\n";

                                if (q is ObjectiveQuestion)
                                {
                                    ObjectiveQuestion oq = (ObjectiveQuestion)q;
                                    if (oq.Submitted != null)
                                    {
                                        questionInfo = questionInfo + oq.Choices[oq.Submitted.Answer - 1] + "\n";
                                    }
                                    else
                                    {
                                        questionInfo = questionInfo + "Candidate didn't answer the question\n";
                                    }
                                }
                                else if (q is DescriptiveQuestion)
                                {
                                    DescriptiveQuestion dq = (DescriptiveQuestion)q;
                                    if (dq.Submitted != null)
                                    {
                                        questionInfo = questionInfo + dq.Submitted.Answer;
                                    }
                                    else
                                    {
                                        questionInfo = questionInfo + "Candidate didn't answer the question\n";
                                    }
                                }
                                else
                                {
                                    ActionBasedQuestion aq = (ActionBasedQuestion)q;
                                    if (aq.Submitted != null)
                                    {
                                        questionInfo = questionInfo + "Candidate answered the question correctly";
                                    }
                                    else
                                    {
                                        questionInfo = questionInfo + "Candidate didn't answer the question\n";
                                    }
                                }

                                Paragraph questionParagraph = new Paragraph(questionInfo);
                                doc.Add(questionParagraph);
                            }
                            i++;
                        }
                    }
                    doc.Close();
                    MessageBox.Show("Report Creation is successful\n", "Report Creation",
                                    MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Report Creation is failed\n" + ex.Message,
                                "Report Creation", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 12
0
 public ImageBookBAL()
 {
     sql = new SQLManager();
 }
Ejemplo n.º 13
0
        public static string GenerateVideo(List <Interval> timeIntervals)
        {
            int           i = 0;
            string        outputFileName = null;
            List <string> outputs        = new List <string>();
            SQLManager    sql            = new SQLManager();

            if (!Directory.Exists("MultipleTemp"))
            {
                Directory.CreateDirectory("MultipleTemp");
            }


            System.IO.DirectoryInfo di = new DirectoryInfo("MultipleTemp/");
            foreach (FileInfo file in di.GetFiles())
            {
                file.Delete();
            }

            foreach (Interval Time in timeIntervals)
            {
                i++;
                List <Video> vidFiles = sql.GetFiles(Time.cameraName, Time.startTime.ToString("hh:mm:ss"), Time.endTime.ToString("hh:mm:ss"));
                string       file     = i + ".mp4";
                if (vidFiles.Count < 1)
                {
                    //no video found
                    return(null);
                }
                else if (vidFiles.Count == 1)
                {
                    CutVideo(vidFiles[0].FileName, "Cut/" + file, Time.startTime.ToString("hh:mm:ss"), Time.endTime.ToString("hh:mm:ss"), vidFiles[0].StartTime.ToString("hh:mm:ss"));
                    outputs.Add(file);
                }
                else
                {
                    int count = vidFiles.Count;
                    CutVideo(vidFiles[0].FileName, "MultipleTemp/" + "0.mp4", Time.startTime.ToString("hh:mm:ss"), vidFiles[0].EndTime.ToString("hh:mm:ss"), vidFiles[0].StartTime.ToString("hh:mm:ss"));
                    CutVideo(vidFiles[count - 1].FileName, "MultipleTemp/" + "1.mp4", vidFiles[count - 1].StartTime.ToString("hh:mm:ss"), Time.endTime.ToString("hh:mm:ss"), vidFiles[0].StartTime.ToString("hh:mm:ss"));
                    List <string> temp = new List <string>();
                    temp.Add("MultipleTemp/0.mp4");
                    for (int j = 1; j < count - 1; j++)
                    {
                        temp.Add(vidFiles[j].FileName);
                    }
                    temp.Add("MultipleTemp/1.mp4");
                    combinevidsList(temp, file);
                    outputs.Add(file);
                }
            }
            if (!Directory.Exists(Global.VideoOutputDirectory))
            {
                Directory.CreateDirectory(Global.VideoOutputDirectory);
            }

            DateTime time = DateTime.Now;

            outputFileName = "Output-" + time.ToString("hh:mm:ss") + ".mp4";
            combinevidsList(outputs, outputFileName);
            return(outputFileName);
        }
Ejemplo n.º 14
0
        // Método responsable de hacer toda la preparación de los datos para enviarlo como parámetro al SP/FUNCTION
        // que se encargan de dar de alta todos los registros asociados a una COMPRA. Por ejemplo, altas en compras,
        // en pasajes, en encomiendas, en tarjetas (si se pago de esa forma y la tarjeta no existe) etc.
        private void cargarDatosDeCompra(string codigoPNR)
        {
            int cliCod;
            int viajeCod;
            int dni;
            int tel;
            DateTime fechaNac;
            decimal precio;
            decimal peso;
            int butNro;
            int encontrado;
            int actualizar;
            int dniTxt;

            int.TryParse(txtDni.Text, out dniTxt);

            DataTable tablaPasajes = new DataTable();

            tablaPasajes.Columns.Add("Código", typeof(int));
            tablaPasajes.Columns.Add("DNI", typeof(int));
            tablaPasajes.Columns.Add("Nombre", typeof(string));
            tablaPasajes.Columns.Add("Apellido", typeof(string));
            tablaPasajes.Columns.Add("Dirección", typeof(string));
            tablaPasajes.Columns.Add("Teléfono", typeof(int));
            tablaPasajes.Columns.Add("Mail", typeof(string));
            tablaPasajes.Columns.Add("Fecha de nacimiento", typeof(DateTime));
            tablaPasajes.Columns.Add("Código de viaje", typeof(int));
            tablaPasajes.Columns.Add("Importe", typeof(decimal));
            tablaPasajes.Columns.Add("Butaca", typeof(int));
            tablaPasajes.Columns.Add("Matrícula", typeof(string));
            tablaPasajes.Columns.Add("Encontrado", typeof(bool));
            tablaPasajes.Columns.Add("Actualizar", typeof(bool));
            tablaPasajes.Columns.Add("ES_COMPRADOR", typeof(int));

            foreach (DataGridViewRow row in pasajes.Rows)
            {
                int.TryParse(row.Cells["Código"].Value.ToString(), out cliCod);
                int.TryParse(row.Cells["Código de viaje"].Value.ToString(), out viajeCod);
                int.TryParse(row.Cells["DNI"].Value.ToString(), out dni);
                int.TryParse(row.Cells["Teléfono"].Value.ToString(), out tel);
                DateTime.TryParse(row.Cells["Fecha de nacimiento"].Value.ToString(), out fechaNac);
                precio = enDecimal(row.Cells["Importe"].Value.ToString());
                int.TryParse(row.Cells["Butaca"].Value.ToString(), out butNro);
                int esComprador;

                totalAAbonar = totalAAbonar + precio;

                if ((bool)row.Cells["Encontrado"].Value)
                {
                    encontrado = 1;
                }
                else
                {
                    encontrado = 0;
                }

                if ((bool)row.Cells["Actualizar"].Value)
                {
                    actualizar = 1;
                }
                else
                {
                    actualizar = 0;
                }

                if (dni == dniTxt)
                {
                    esComprador = 1;
                }
                else
                {
                    esComprador = 0;
                }

                tablaPasajes.Rows.Add(cliCod,dni,
                    row.Cells["Nombre"].Value.ToString(),
                    row.Cells["Apellido"].Value.ToString(),
                    row.Cells["Dirección"].Value.ToString(),
                    tel,
                    row.Cells["Mail"].Value.ToString(),
                    fechaNac,viajeCod, precio, butNro,
                    row.Cells["Matrícula"].Value.ToString(),
                    encontrado, actualizar, esComprador);

            }

            DataTable tablaEncomiendas = new DataTable();

            tablaEncomiendas.Columns.Add("Código", typeof(int));
            tablaEncomiendas.Columns.Add("DNI", typeof(int));
            tablaEncomiendas.Columns.Add("Nombre", typeof(string));
            tablaEncomiendas.Columns.Add("Apellido", typeof(string));
            tablaEncomiendas.Columns.Add("Dirección", typeof(string));
            tablaEncomiendas.Columns.Add("Teléfono", typeof(int));
            tablaEncomiendas.Columns.Add("Mail", typeof(string));
            tablaEncomiendas.Columns.Add("Fecha de nacimiento", typeof(DateTime));
            tablaEncomiendas.Columns.Add("Código de viaje", typeof(int));
            tablaEncomiendas.Columns.Add("Importe", typeof(decimal));
            tablaEncomiendas.Columns.Add("Kilos", typeof(decimal));
            tablaEncomiendas.Columns.Add("Matrícula", typeof(string));
            tablaEncomiendas.Columns.Add("Encontrado", typeof(bool));
            tablaEncomiendas.Columns.Add("Actualizar", typeof(bool));
            tablaEncomiendas.Columns.Add("ES_COMPRADOR", typeof(int));

            foreach (DataGridViewRow row in encomiendas.Rows)
            {
                int.TryParse(row.Cells["Código"].Value.ToString(), out cliCod);
                int.TryParse(row.Cells["Código de viaje"].Value.ToString(), out viajeCod);
                int.TryParse(row.Cells["DNI"].Value.ToString(), out dni);
                int.TryParse(row.Cells["Teléfono"].Value.ToString(), out tel);
                DateTime.TryParse(row.Cells["Fecha de nacimiento"].Value.ToString(), out fechaNac);
                precio = enDecimal(row.Cells["Importe"].Value.ToString());
                peso = enDecimal(row.Cells["Kilos"].Value.ToString());
                int esComprador;

                totalAAbonar = totalAAbonar + precio;

                if ((bool)row.Cells["Encontrado"].Value)
                {
                    encontrado = 1;
                }
                else
                {
                    encontrado = 0;
                }

                if ((bool)row.Cells["Actualizar"].Value)
                {
                    actualizar = 1;
                }
                else
                {
                    actualizar = 0;
                }

                if (dni == dniTxt)
                {
                    esComprador = 1;
                }
                else
                {
                    esComprador = 0;
                }

                tablaEncomiendas.Rows.Add(cliCod,dni,
                    row.Cells["Nombre"].Value.ToString(),
                    row.Cells["Apellido"].Value.ToString(),
                    row.Cells["Dirección"].Value.ToString(),
                    tel,
                    row.Cells["Mail"].Value.ToString(),
                    fechaNac,viajeCod, precio, peso,
                    row.Cells["Matrícula"].Value.ToString(),
                    encontrado, actualizar, esComprador);

            }

            int vencMes;
            int vencAnio;
            int cuotas;
            int.TryParse(cboMeses.Text, out vencMes);
            int.TryParse(cboAnios.Text, out vencAnio);
            int.TryParse(cboCuotas.Text, out cuotas);

            SQLManager manager = new SQLManager();

            if (tarjetaNueva)
            {

                manager = manager.generarSP("ingresarDatosDeCompra")
                                 .agregarTableSP("@TablaPasajes", tablaPasajes)
                                 .agregarTableSP("@TablaEncomiendas", tablaEncomiendas)
                                 .agregarIntSP("@clienteCodigo", clienteCodigo)
                                 .agregarIntSP("@dni", txtDni)
                                 .agregarStringSP("@ape", txtApe)
                                 .agregarStringSP("@nombre", txtNom)
                                 .agregarStringSP("@direccion", txtDire)
                                 .agregarStringSP("@mail", txtMail)
                                 .agregarFechaSP("@fechanac", dp)
                                 .agregarIntSP("@telefono", txtTel)
                                 .agregarBooleanoSP("@encontroComprador", encontroCliente)
                                 .agregarBooleanoSP("@actualizarComprador", actualizarTabla)
                                 .agregarStringSP("@codigoPNR", codigoPNR)
                                 .agregarIntSP("@cuotas", cuotas)
                                 .agregarStringSP("@formaDePago", cboFormaPago)
                                 .agregarInt64SP("@nroTarjeta", txtNroTarjeta)
                                 .agregarIntSP("@codSeg", txtCodSeg)
                                 .agregarIntSP("@vencMes", vencMes)
                                 .agregarIntSP("@vencAnio", vencAnio)
                                 .agregarStringSP("@tipoTarjeta", cboTipoTarjeta)
                                 .agregarBooleanoSP("@agregarTarjeta", tarjetaNueva);

            }
            else
            {
                if (esEfectivo)
                {

                    manager = manager.generarSP("ingresarDatosDeCompra")
                                 .agregarTableSP("@TablaPasajes", tablaPasajes)
                                 .agregarTableSP("@TablaEncomiendas", tablaEncomiendas)
                                 .agregarIntSP("@clienteCodigo", clienteCodigo)
                                 .agregarIntSP("@dni", txtDni)
                                 .agregarStringSP("@ape", txtApe)
                                 .agregarStringSP("@nombre", txtNom)
                                 .agregarStringSP("@direccion", txtDire)
                                 .agregarStringSP("@mail", txtMail)
                                 .agregarFechaSP("@fechanac", dp)
                                 .agregarIntSP("@telefono", txtTel)
                                 .agregarBooleanoSP("@encontroComprador", encontroCliente)
                                 .agregarBooleanoSP("@actualizarComprador", actualizarTabla)
                                 .agregarStringSP("@codigoPNR", codigoPNR)
                                 .agregarIntSP("@cuotas", 0)
                                 .agregarStringSP("@formaDePago", cboFormaPago)
                                 .agregarInt64SP("@nroTarjeta", 0)
                                 .agregarIntSP("@codSeg", 0)
                                 .agregarIntSP("@vencMes", 0)
                                 .agregarIntSP("@vencAnio", 0)
                                 .agregarStringSP("@tipoTarjeta", "nada")
                                 .agregarBooleanoSP("@agregarTarjeta", tarjetaNueva);

                }
                else
                {
                    manager = manager.generarSP("ingresarDatosDeCompra")
                                 .agregarTableSP("@TablaPasajes", tablaPasajes)
                                 .agregarTableSP("@TablaEncomiendas", tablaEncomiendas)
                                 .agregarIntSP("@clienteCodigo", clienteCodigo)
                                 .agregarIntSP("@dni", txtDni)
                                 .agregarStringSP("@ape", txtApe)
                                 .agregarStringSP("@nombre", txtNom)
                                 .agregarStringSP("@direccion", txtDire)
                                 .agregarStringSP("@mail", txtMail)
                                 .agregarFechaSP("@fechanac", dp)
                                 .agregarIntSP("@telefono", txtTel)
                                 .agregarBooleanoSP("@encontroComprador", encontroCliente)
                                 .agregarBooleanoSP("@actualizarComprador", actualizarTabla)
                                 .agregarStringSP("@codigoPNR", codigoPNR)
                                 .agregarIntSP("@cuotas", cuotas)
                                 .agregarStringSP("@formaDePago", cboFormaPago)
                                 .agregarInt64SP("@nroTarjeta", txtNroTarjeta)
                                 .agregarIntSP("@codSeg", txtCodSeg)
                                 .agregarIntSP("@vencMes", vencMes)
                                 .agregarIntSP("@vencAnio", vencAnio)
                                 .agregarStringSP("@tipoTarjeta", cboTipoTarjeta)
                                 .agregarBooleanoSP("@agregarTarjeta", tarjetaNueva);

                }

            }

            try
            {
                manager.ejecutarSP();
                MessageBox.Show("Se realizo la compra con éxito. Su codigo de PNR: " + codigoPNR + ". Monto a abonar: " + totalAAbonar.ToString() + ".", "Compra de pasajes y/o encomiendas", MessageBoxButtons.OK);
            }
            catch
            {
                MessageBox.Show("Fallo en la compra", "Fallo Compra", MessageBoxButtons.OK);
                this.Close();
                return;
            }
        }
Ejemplo n.º 15
0
 public PublisherBAL()
 {
     sql = new SQLManager();
 }
Ejemplo n.º 16
0
 public bool Supprimer(int id)
 {
     return(_BDD.ExecuterCommandeSQL(SQLManager.SupprimerUtilisateur(id)));
 }
Ejemplo n.º 17
0
        private void suplantarAeronave()
        {
            SQLManager sqlManager = new SQLManager().generarSP("SuplantarAeronave")
                                                    .agregarStringSP("@Matricula", matricula)
                                                    .agregarFechaSP("@FechaBaja", fechaBaja);
            if (llamadoDesdeBajaLogica)
                sqlManager = sqlManager.agregarFechaNula("@FechaReinicio");
            else
                sqlManager = sqlManager.agregarFechaSP("@FechaReinicio", fechaReinicio);

            sqlManager.ejecutarSP();
        }
Ejemplo n.º 18
0
        /*
         * Init checkbox fields to exclude the key column
         */
        void InitCheckboxFields()
        {
            CheckBoxListInputColumns.DataSource = null;
            CheckBoxListInputColumns.DataBind();

            CheckBoxListPredictColumns.DataSource = null;
            CheckBoxListPredictColumns.DataBind();

            // execute query
            SQLManager manager = new SQLManager(sCatalog);
            DataTable objTable = new DataTable();

            // handle errors
            //if (manager.GetQueryResult(sQueryText) == null)
            //{
            //    HandleQueryError();
            //    return;
            //}

            // exclude the key column
            string sQueryTextExclude = "SELECT COLUMN_NAME, ORDINAL_POSITION FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" +
                DropDownListTables.SelectedItem.ToString() + "' AND COLUMN_NAME <> '" + DropDownListKey.SelectedItem.ToString() + " 'ORDER BY ORDINAL_POSITION";

            objTable.Load(manager.GetQueryResult(sQueryTextExclude));

            CheckBoxListInputColumns.DataSource = objTable;
            CheckBoxListInputColumns.DataTextField = "COLUMN_NAME";
            CheckBoxListInputColumns.DataValueField = "ORDINAL_POSITION";
            CheckBoxListInputColumns.DataBind();

            CheckBoxListPredictColumns.DataSource = objTable;
            CheckBoxListPredictColumns.DataTextField = "COLUMN_NAME";
            CheckBoxListPredictColumns.DataValueField = "ORDINAL_POSITION";
            CheckBoxListPredictColumns.DataBind();

            manager.CloseConnection();
        }
Ejemplo n.º 19
0
        /*
         * Metodo que se encarga de invocar al SQLManager para armar la cadena que ejecuta
         * la procedure GenerarNuevoViaje, el cual inserta el nuevo registro en la tabla de viajes,
         * siempre y cuando se cumplan las restricciones del formulario, y siempre que la insercion
         * no haya sido fallida. En caso de no poder insertarse el registro (ya sea por fallo de constrains,
         * o algun otro fallo relacionado a la integridad de los datos), se lanzara una excepcion que se
         * cacheada en la aplicacion
         */
        private Object insertarNuevoViaje()
        {
            SQLManager manejador = new SQLManager();
            manejador.generarSP("GenerarNuevoViaje");
            manejador.agregarStringSP("@salida", dateTimePicker1.Value.ToString());
            manejador.agregarStringSP("@llegadaEstimada", dateTimePicker2.Value.ToString());
            manejador.agregarIntSP("@ruta", txtRuta);
            manejador.agregarStringSP("@matricula", txtMatricula.Text);

            try
            {
                manejador.ejecutarSP();
                return 1;
            }
            catch (System.Exception e)
            {
                MessageBox.Show(e.Message, "Erro al generar el nuevo viaje", MessageBoxButtons.OK);
                return null;
            }
        }
Ejemplo n.º 20
0
        /*
         * Init all columns
         */
        private void InitColumnsControlls()
        {
            // clear current query
            DropDownListKey.DataSource = null;
            DropDownListKey.DataBind();

            // list selected table: to be removed
            //Label1.Text = ListBoxTables.SelectedItem.ToString();

            string sQueryText = "SELECT COLUMN_NAME, ORDINAL_POSITION FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" +
                DropDownListTables.SelectedItem.ToString() + "'ORDER BY ORDINAL_POSITION";

            // execute query
            SQLManager manager = new SQLManager(sCatalog);
            DataTable objTable = new DataTable();

            // handle errors
            //if (manager.GetQueryResult(sQueryText) == null)
            //{
            //    HandleQueryError();
            //    return;
            //}

            objTable.Load(manager.GetQueryResult(sQueryText));

            DropDownListKey.DataSource = objTable;
            DropDownListKey.DataTextField = "COLUMN_NAME";
            DropDownListKey.DataValueField = "ORDINAL_POSITION";
            DropDownListKey.DataBind();

            manager.CloseConnection();

            // init input columns
            InitCheckboxFields();
        }
Ejemplo n.º 21
0
        /*
         * Create mining structure with cusomt fields
         */
        private MiningStructure CreateCustomMiningStructure(Database objDatabase, string sStructName, string sTableName, string sKeyColumn, List<string> lsInputColumns, List<string> lsPredictColumns, string sAlgorithm, List<bool> lbPredictColumns)
        {
            // drop the existing structures with the same name
            MiningStructure currentMiningStruct = objDatabase.MiningStructures.FindByName(sStructName);
            if (currentMiningStruct != null)
                currentMiningStruct.Drop();

            // Initialize a new mining structure
            currentMiningStruct = new MiningStructure(sStructName, sStructName);
            currentMiningStruct.Source = new DataSourceViewBinding(objDatabase.DataSourceViews[0].Name);

            // get data type for the selected column
            string sQueryText = "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" +
                sTableName + "' AND COLUMN_NAME = '" + sKeyColumn + "'";

            // execute query
            SQLManager manager = new SQLManager("MyDataBase");
            DataTable objTable = new DataTable();

            // get column data type
            objTable.Load(manager.GetQueryResult(sQueryText));
            string sDataType = objTable.Rows[0][0].ToString();

            manager.CloseConnection();

            // create key column
            ScalarMiningStructureColumn StructKey = new ScalarMiningStructureColumn(sKeyColumn, sKeyColumn);
            StructKey.Type = GetColumnStructureType(sDataType);
            StructKey.Content = MiningStructureColumnContents.Key;
            StructKey.IsKey = true;
            StructKey.KeyColumns.Add("dbo_" + sTableName, sKeyColumn, GetColumnDataType(sDataType));
            currentMiningStruct.Columns.Add(StructKey);

            // input columns
            for (int i = 0; i < lsInputColumns.Count; i++)
            {
                // get data type for the selected column
                sQueryText = "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" +
                    sTableName + "' AND COLUMN_NAME = '" + lsInputColumns[i] + "'";

                // get column data type
                objTable = new DataTable();
                objTable.Load(manager.GetQueryResult(sQueryText));
                sDataType = objTable.Rows[0][0].ToString();

                // Generation column
                ScalarMiningStructureColumn Input = new ScalarMiningStructureColumn(lsInputColumns[i], lsInputColumns[i]);
                Input.Type = GetColumnStructureType(sDataType);

                if (Input.Type == MiningStructureColumnTypes.Long)
                    Input.Content = MiningStructureColumnContents.Continuous;
                else
                    Input.Content = MiningStructureColumnContents.Discrete;

                // Add data binding to the column
                Input.KeyColumns.Add("dbo_" + sTableName, lsInputColumns[i], GetColumnDataType(sDataType));
                // Add the column to the mining structure
                currentMiningStruct.Columns.Add(Input);

                manager.CloseConnection();
            }

            // add predict columns
            // input columns
            for (int i = 0; i < lsPredictColumns.Count; i++)
            {
                // if value = false (input & predict) then skip
                if (lbPredictColumns[i] == false)
                    continue;

                // get data type for the selected column
                sQueryText = "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" +
                    sTableName + "' AND COLUMN_NAME = '" + lsPredictColumns[i] + "'";

                // get column data type
                objTable = new DataTable();
                objTable.Load(manager.GetQueryResult(sQueryText));
                sDataType = objTable.Rows[0][0].ToString();

                // Generation column
                ScalarMiningStructureColumn Input = new ScalarMiningStructureColumn(lsPredictColumns[i], lsPredictColumns[i]);
                Input.Type = GetColumnStructureType(sDataType);

                // for double and long set to continous, else is discrete
                if (Input.Type == MiningStructureColumnTypes.Long || Input.Type == MiningStructureColumnTypes.Double)
                    Input.Content = MiningStructureColumnContents.Continuous;
                else
                    Input.Content = MiningStructureColumnContents.Discrete;

                // Add data binding to the column
                Input.KeyColumns.Add("dbo_" + sTableName, lsPredictColumns[i], GetColumnDataType(sDataType));
                // Add the column to the mining structure
                currentMiningStruct.Columns.Add(Input);

                manager.CloseConnection();
            }

            // Add the mining structure to the database
            objDatabase.MiningStructures.Add(currentMiningStruct);
            currentMiningStruct.Update();

            return currentMiningStruct;
        }
Ejemplo n.º 22
0
        /*
         * Init all table names into a listbox
         */
        private void InitTableNames()
        {
            // show DB tables
            SQLManager manager = new SQLManager(sCatalog);
            string sQuery = "Select name, id from sysobjects where xtype='U'";

            // handle errors
            //if (manager.GetQueryDataSet(sQuery) == null)
            //{
            //    HandleQueryError();
            //    return;
            //}

            DataSet objSet = manager.GetQueryDataSet(sQuery);
            DropDownListTables.DataSource = objSet;
            DropDownListTables.DataTextField = "name";
            DropDownListTables.DataValueField = "id";
            DropDownListTables.DataBind();
            manager.CloseConnection();
        }
Ejemplo n.º 23
0
 private Object cancelarPasajesYEncomiendas()
 {
     SQLManager sqlManager = new SQLManager();
     return sqlManager.generarSP("CancelarPasajesYEncomiendas").
            agregarStringSP("@Codigo", txtCodigo.Text).
            agregarListaSP("@Pasajes", pasajes).
            agregarListaSP("@Encomiendas", encomiendas).
            agregarFechaSP("@FechaDevolucion", Program.fechaHoy()).
            agregarStringSP("@Motivo" , motivo).
            ejecutarSP();
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Effectue la connexion avec la BDD
 /// </summary>
 /// <param name="sQLManager"></param>
 public ContratDAO(SQLManager sQLManager) : base(sQLManager)
 {
 }
Ejemplo n.º 25
0
        void loadConfig(bool forDeploy = false)
        {
            log("Loading client configuration");

            clientConfigManager = new ClientConfigManager();

            rootPath = workingDirectory;
            binPath  = rootPath + "bin\\" + branch + "\\";

            if (!System.IO.Directory.Exists(rootPath + "bin\\"))
            {
                System.IO.Directory.CreateDirectory(rootPath + "bin\\");
            }

            if (!System.IO.Directory.Exists(rootPath + "bin\\" + branch + "\\"))
            {
                System.IO.Directory.CreateDirectory(rootPath + "bin\\" + branch + "\\");
            }

            string buildconf = "build";

            if (rootPath.Contains("buildagent2"))
            {
                buildconf = "build2";
            }

            clientConfigManager.load(rootPath + "config\\" + (forDeploy ? branch : buildconf) + "_" + "usp" + ".axc"); //  rootPath + "config\\" + clientConfig);

            log("Client configuration loaded");

            log("Loading server configuration");

            serverConfigManager = new ServerConfigManager();

            serverConfigManager.load(clientConfigManager.ServerName, clientConfigManager.PortNumber);

            log("Server configuration loaded");

            mgr = new AOSManager()
            {
                ServerName     = clientConfigManager.ServerName,              // "april-ax-build",
                ServiceId      = serverConfigManager.ServerServiceIdentifier, // "AOS60$01",
                TimeOutMinutes = 10
            };

            if (forDeploy)
            {
                mgr.TimeOutMinutes = 30;
            }

            client = new ClientManager();

            client.AXClientBinPath     = clientConfigManager.ClientBinPath;
            client.AXServerBinPath     = serverConfigManager.ServerBinPath;
            client.AXConfigurationFile = rootPath + "config\\" + (forDeploy ? branch : buildconf) + "_" + "usp" + ".axc"; // rootPath + "config\\" + clientConfig;
            client.ModelManifest       = rootPath + branch + "\\" + modelName + "\\Model.xml";
            client.TimeOutMinutes      = 60;

            model = new ModelManager()
            {
                AOSName    = serverConfigManager.AOSName,
                SchemaName = "temp"
            };

            sqlManager = new SQLManager();

            sqlManager.DatabaseName = serverConfigManager.DatabaseName;
            sqlManager.Server       = serverConfigManager.DatabaseServer;

            labelManager = new LabelManager();
        }
Ejemplo n.º 26
0
 public static void MyTestInitialize(TestContext testContext)
 {
     SettingsManager.context = testContext;
     Data     = SettingsManager.Instance().Data;
     DbClient = new SQLManager(Data.StringConnection);
 }
Ejemplo n.º 27
0
        public FacilityApplyResponse Post([FromBody] FacilityApplyRequest req)
        {
            FacilityApplyResponse resp = new FacilityApplyResponse();

            try
            {
                if (req.starttime >= req.endtime)
                {
                    resp.result = "fail";
                    return(resp);
                }

                //确保申请时间晚于当前
                DateTime today     = DateTime.Now;                                                 //获取当前时间
                string   applyHour = req.starttime.ToString("00");                                 //转换小时为字符串
                string   testTime  = req.date.ToString("yyyy-MM-dd") + " " + applyHour + ":00:00"; //连接成申请时刻
                if (DateTime.Compare(today, Convert.ToDateTime(testTime)) > 0)
                {
                    resp.result = "fail";
                    return(resp);
                }

                MySqlConnection conn = SQLManager.getConn(); //连接数据库
                conn.Open();                                 //打开数据库连接
                MySqlCommand test = null;                    //创建查询指令
                test = new MySqlCommand("select start_time,end_time,max_capacity,start_day,end_day " +
                                        "from facilities where facility_ID=?facility;", conn);
                test.Parameters.AddWithValue("?facility", req.facility);
                MySqlDataReader mdr = test.ExecuteReader();//查询设施信息
                if (!mdr.HasRows)
                {
                    resp.result = "wrong facility";//id错误
                    mdr.Close();
                    conn.Close();
                    return(resp);
                }
                else
                {
                    mdr.Read();
                    FacilityInfo info = new FacilityInfo();                   //存储设施信息类
                    info.start    = Convert.ToInt32(mdr.GetValue(0));         //存储开放起始时间
                    info.end      = Convert.ToInt32(mdr.GetValue(1));         //存储开放结束时间
                    info.capacity = Convert.ToInt32(mdr.GetValue(2));         //存储容量
                    info.startday = Convert.ToInt32(mdr.GetValue(3));         //开放起始日期
                    info.endday   = Convert.ToInt32(mdr.GetValue(4));         //开放最后日期
                    mdr.Close();
                    if (req.starttime < info.start || req.endtime > info.end) //检查申请时间是否符合要求
                    {
                        conn.Close();
                        resp.result = "invalid time";
                        return(resp);
                    }
                    int weekday = GetWeek(req.date);                      //转换int星期几
                    if (weekday < info.startday || weekday > info.endday) //检查日期是否符合要求
                    {
                        conn.Close();
                        resp.result = "invalid date";
                        return(resp);
                    }
                    MySqlCommand cmd = null;//创建查询指令

                    //查询健康状态
                    cmd = new MySqlCommand("select currenthealth_status from student " +
                                           "where student_ID=@id;", conn);
                    cmd.Parameters.AddWithValue("@id", req.id);
                    mdr = cmd.ExecuteReader();
                    mdr.Read();
                    if (!mdr.HasRows)
                    {
                        resp.result = "wrong id";//id错误
                        mdr.Close();
                        conn.Close();
                        return(resp);
                    }
                    int health = Convert.ToInt32(mdr.GetValue(0));
                    mdr.Close();
                    if (health != 0)//若健康状态不为“健康”,申请失败
                    {
                        conn.Close();
                        resp.result = "unqualified";
                        return(resp);
                    }

                    // 查询违约记录
                    cmd = new MySqlCommand("select count(*) from default_record " +
                                           "where applicant_ID=@id;", conn);
                    cmd.Parameters.AddWithValue("@id", req.id);
                    mdr = cmd.ExecuteReader();
                    mdr.Read();
                    int count = Convert.ToInt32(mdr.GetValue(0));
                    mdr.Close();
                    if (count != 0 && count % 3 == 0)//若违约次数为3的整数倍,检查是否在最近一周违约
                    {
                        cmd = new MySqlCommand("select date from default_record " +
                                               "where applicant_ID=@id and count=@count;", conn);
                        cmd.Parameters.AddWithValue("@id", req.id);
                        cmd.Parameters.AddWithValue("@count", count);
                        mdr = cmd.ExecuteReader();
                        mdr.Read();
                        DateTime lastdate = Convert.ToDateTime(mdr.GetValue(0));
                        mdr.Close();
                        DateTime current = DateTime.Now;
                        TimeSpan ts1     = new TimeSpan(lastdate.Ticks);
                        TimeSpan ts2     = new TimeSpan(current.Ticks);
                        TimeSpan ts      = ts1.Subtract(ts2).Duration();
                        int      days    = Convert.ToInt32(ts.Days.ToString());
                        if (days < 7)//最后一次违约记录在7天以内
                        {
                            conn.Close();
                            resp.result = "unqualified";
                            return(resp);
                        }
                    }

                    string date = req.date.ToString("yyyy-MM-dd");
                    //检查同一申请人申请时间段是否已有其他申请
                    cmd = new MySqlCommand("select applicant_ID from application " +
                                           "where applicant_ID=@id and date=@date and " +
                                           "((start_time>=@start and start_time<@end) or (end_time<=@end and end_time>@start));", conn);
                    cmd.Parameters.AddWithValue("@id", req.id);
                    cmd.Parameters.AddWithValue("@date", date);
                    cmd.Parameters.AddWithValue("@start", req.starttime);
                    cmd.Parameters.AddWithValue("@end", req.endtime);
                    mdr = cmd.ExecuteReader();
                    if (mdr.HasRows)//已有其他申请
                    {
                        mdr.Close();
                        conn.Close();
                        resp.result = "time overlap";
                        return(resp);
                    }
                    mdr.Close();

                    /*
                     * int[] quantity;//存储每一时间段人数
                     * int hours = req.endtime - req.starttime;
                     * quantity = new int[hours];*/

                    //查看每一时间段申请总人数
                    for (int i = req.starttime; i < req.endtime; i++)
                    {
                        cmd = new MySqlCommand("select count(*) from application " +
                                               "where facility_ID=@id and date=@date and start_time<=@start and end_time>=@end;", conn);
                        cmd.Parameters.AddWithValue("@id", req.facility);
                        cmd.Parameters.AddWithValue("@date", date);
                        cmd.Parameters.AddWithValue("@start", i);
                        cmd.Parameters.AddWithValue("@end", i + 1);
                        mdr = cmd.ExecuteReader();
                        if (mdr.HasRows)
                        {
                            mdr.Read();                  /*
                                                          * quantity[i - req.starttime] = Convert.ToInt32(mdr.GetValue(0));*/
                            int number = Convert.ToInt32(mdr.GetValue(0));
                            if (number >= info.capacity) //若有时间段预约数已达到容量上限,预约失败
                            {
                                mdr.Close();
                                conn.Close();
                                resp.result = "no left";
                                return(resp);
                            }
                        }/*
                          * else
                          * quantity[i - req.starttime] = 0;*/
                        mdr.Close();
                    }

                    //所有条件符合,插入记录
                    cmd = new MySqlCommand("insert into application (applicant_ID,facility_ID,date,start_time,end_time)" +
                                           "values(@id,@facility,@date,@start,@end);", conn);
                    cmd.Parameters.AddWithValue("@id", req.id);
                    cmd.Parameters.AddWithValue("@facility", req.facility);
                    cmd.Parameters.AddWithValue("@date", date);
                    cmd.Parameters.AddWithValue("@start", req.starttime);
                    cmd.Parameters.AddWithValue("@end", req.endtime);
                    cmd.Prepare();
                    cmd.ExecuteNonQuery();//执行insert语句
                    resp.result = "success";
                }
                conn.Close();//关闭连接
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                resp.result = "fail";
            }
            return(resp);
        }
Ejemplo n.º 28
0
        public void GetChecked(string msg)
        {
            int    reqID;
            int    id        = 0;
            int    userID    = 0;
            string loc       = "";
            string cityCode  = "";
            int    years     = 0;
            int    branchCtr = 0;
            string branchID  = "";

            foreach (GridViewRow gvrow in gvRequests.Rows)
            {
                CheckBox chk = (CheckBox)gvrow.FindControl("cbSelect");
                if (chk != null && chk.Checked)
                {
                    reqID = Convert.ToInt32(gvrow.Cells[1].Text);
                    var    cs         = ConfigurationManager.ConnectionStrings["ZoomDB"];
                    string connection = cs.ConnectionString;

                    SqlConnection  sqlconnect = new SqlConnection(connection);
                    SqlDataAdapter adapt      = new SqlDataAdapter("Select * from ReqStatFranch", sqlconnect);
                    DataSet        dsReq      = new DataSet();

                    adapt.Fill(dsReq, "ReqStatFranch");
                    DataTable tblReq;
                    tblReq = dsReq.Tables["ReqStatFranch"];

                    foreach (DataRow row in tblReq.Rows)
                    {
                        if (reqID == Convert.ToInt32(row["id"].ToString()))
                        {
                            userID   = Convert.ToInt32(row["userid"].ToString());
                            loc      = row["location"].ToString();
                            cityCode = row["cityCode"].ToString();
                            years    = Convert.ToInt32(row["years"].ToString());
                            break;
                        }
                    }


                    adapt = new SqlDataAdapter("Select * from citytown", sqlconnect);
                    dsReq = new DataSet();

                    adapt.Fill(dsReq, "citytown");
                    tblReq = dsReq.Tables["citytown"];

                    foreach (DataRow row in tblReq.Rows)
                    {
                        if (cityCode == row["Code"].ToString())
                        {
                            branchCtr = Convert.ToInt32(row["Branches"].ToString());
                            break;
                        }
                    }
                    //*****************************COMMANDS TO UPDATE CUSTOMER TO OWNER && ADDING TO BRANCH TABLE
                    branchID = cityCode + "-" + (branchCtr + 1).ToString();
                    SQLManager.SQLUpdateCustToOwner(userID);
                    _Branch B = new _Branch(loc, userID, branchID, cityCode);
                    SQLManager.SQLAddBranch(B);
                    SQLManager.SQLUpdateCityCtr(branchCtr, cityCode);

                    //*********************************ADD TO FRANCHISE TABLE
                    adapt = new SqlDataAdapter("Select * from branch", sqlconnect);
                    dsReq = new DataSet();

                    adapt.Fill(dsReq, "branch");
                    tblReq = dsReq.Tables["branch"];

                    foreach (DataRow row in tblReq.Rows)
                    {
                        if (branchID == row["branchID"].ToString())
                        {
                            id = Convert.ToInt32(row["id"].ToString());
                            break;
                        }
                    }
                    sqlconnect.Close();



                    DateTime   start = DateTime.Now;
                    DateTime   end   = start.AddYears(years);
                    _Franchise F     = new _Franchise(id, start, end);
                    SQLManager.SQLAddFranchise(F);
                    SQLManager.DeleteReqStat(reqID);
                    SQLManager.SQLAddNotif(msg, userID);
                }
            }
        }
Ejemplo n.º 29
0
 public CategoryBAL()
 {
     sql = new SQLManager();
 }
Ejemplo n.º 30
0
 protected DAO(SQLManager sQLManager)
 {
     SQLManager = sQLManager;
 }
Ejemplo n.º 31
0
        private void createQuestionButton_Click(object sender, RoutedEventArgs e)
        {
            if (questionTypes.SelectedIndex == 1)
            {
                if (String.IsNullOrEmpty(objectiveQuestion.Text))
                {
                    MessageBox.Show("Question Text cannot be empty\nPlease enter a question text",
                                    "Question Creation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (String.IsNullOrEmpty(option1.Text) ||
                         String.IsNullOrEmpty(option2.Text) ||
                         String.IsNullOrEmpty(option3.Text) ||
                         String.IsNullOrEmpty(option4.Text))
                {
                    MessageBox.Show("Question Option cannot be empty\nPlease enter options of question",
                                    "Question Creation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (correctChoiceComboBox.SelectedIndex == 0)
                {
                    MessageBox.Show("Question Answer isn't selected\nPlease select correct choice",
                                    "Question Creation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    try
                    {
                        SQLManager.addObjectiveQuestion(new ObjectiveQuestion(objectiveQuestion.Text,
                                                                              new String[4] {
                            option1.Text, option2.Text, option3.Text, option4.Text
                        },
                                                                              new ObjectiveAnswer((byte)correctChoiceComboBox.SelectedIndex), -1,
                                                                              questionSubjects.SelectedIndex));
                        resetObjectiveQuestion();
                        resetQuestionTypeSelection();
                        MessageBox.Show("Question creation is successful\n", "Question Creation",
                                        MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Question creation is failed\n" + ex.Message, "Question Creation", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
            else if (questionTypes.SelectedIndex == 2)
            {
                if (String.IsNullOrEmpty(descriptiveQuestion.Text))
                {
                    MessageBox.Show("Question Text cannot be empty\nPlease enter a question text",
                                    "Question Creation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (String.IsNullOrEmpty(descriptiveAnswer.Text))
                {
                    MessageBox.Show("Question Answer cannot be empty\nPlease enter a question answer",
                                    "Question Creation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    try
                    {
                        SQLManager.addDescriptiveQuestion(new DescriptiveQuestion(descriptiveQuestion.Text,
                                                                                  new DescriptiveAnswer(descriptiveAnswer.Text), -1,
                                                                                  questionSubjects.SelectedIndex));
                        resetDescriptiveQuestion();
                        resetQuestionTypeSelection();
                        MessageBox.Show("Question creation is successful\n", "Question Creation",
                                        MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Question creation is failed\n" + ex.Message,
                                        "Question Creation", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
            else
            {
                int selection = questionFunctionComboBox.SelectedIndex;
                if (selection < 1)
                {
                    MessageBox.Show("Please choose a valid question function\n",
                                    "Question Creation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if ((selection == 1 ||
                          selection == 2 ||
                          selection == 3 ||
                          selection == 4) && !checkDirectoryOrFileName(actionName1TextBox.Text))
                {
                    MessageBox.Show("Diretory or File name isn't valid\nPlease enter a valid name\n",
                                    "Question Creation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if ((selection == 5 || selection == 6) &&
                         (!checkDirectoryOrFileName(actionName1TextBox.Text) ||
                          !checkDirectoryOrFileName(actionName1TextBox.Text)))
                {
                    MessageBox.Show("Diretory or File names aren't valid\nPlease enter valid names\n",
                                    "Question Creation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (selection == 7 && String.IsNullOrEmpty(actionText1TextBox.Text))
                {
                    MessageBox.Show("Entered Text cannot be empty\nPlease enter text",
                                    "Question Creation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (selection == 8 && String.IsNullOrEmpty(actionText2TextBox.Text))
                {
                    MessageBox.Show("Entered Texts cannot be empty\nPlease enter text",
                                    "Question Creation Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    String questionText = null;
                    String parameter1   = null;
                    String parameter2   = null;

                    if (selection == 1)
                    {
                        parameter1   = actionName1TextBox.Text;
                        questionText = "Create a directory with name " + parameter1;
                    }
                    else if (selection == 2)
                    {
                        parameter1   = actionName1TextBox.Text;
                        questionText = "Create a text file with name " + parameter1;
                    }
                    else if (selection == 3)
                    {
                        parameter1   = actionName1TextBox.Text;
                        questionText = "Delete the directory with name " + parameter1;
                    }
                    else if (selection == 4)
                    {
                        parameter1   = actionName1TextBox.Text;
                        questionText = "Delete the text file with name " + parameter1;
                    }
                    else if (selection == 5)
                    {
                        parameter1   = actionName1TextBox.Text;
                        parameter2   = actionName2TextBox.Text;
                        questionText = "Change the directory name from " + parameter1 + " to " + parameter2;
                    }
                    else if (selection == 6)
                    {
                        parameter1   = actionName1TextBox.Text;
                        parameter2   = actionName2TextBox.Text;
                        questionText = "Change the text file name from " + parameter1 + " to " + parameter2;
                    }
                    else if (selection == 7)
                    {
                        parameter1   = actionText1TextBox.Text;
                        questionText = "Write " + parameter1 + " into text file with name enlightenment_test.txt";
                    }
                    else if (selection == 8)
                    {
                        parameter1   = actionText1TextBox.Text;
                        parameter2   = actionText2TextBox.Text;
                        questionText = "Change " + parameter1 + " to " + parameter2 +
                                       " in text file with name enlightenment_test.txt";
                    }
                    try
                    {
                        SQLManager.addActionBasedQuestion(new ActionBasedQuestion(
                                                              questionText, selection, parameter1, parameter2, -1, questionSubjects.SelectedIndex));
                        resetActionBasedQuestion();
                        resetQuestionTypeSelection();
                        MessageBox.Show("Question creation is successful\n", "Question Creation",
                                        MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Question creation is failed\n" + ex.Message,
                                        "Question Creation", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
        }
Ejemplo n.º 32
0
        protected void btnsave_Click(object sender, System.EventArgs e)
        {
            try
            {
                //if (Fk_VendorID.SelectedIndex == 0)
                //{
                //    ErrorMessage = ErrorMessage + "Select Invoice.<br>";
                //}
                if (ddlSEWB_Trn_Type.Text.Length == 0)
                {
                    ErrorMessage = ErrorMessage + "Sub Type can not be Blank.<br>";
                }
                if (SEWB_Doc_No.Text.Length == 0)
                {
                    ErrorMessage = ErrorMessage + "Document No Cannot be Blank.<br>";
                }
                if (SEWB_Doc_No.Text.Length == 0)
                {
                    ErrorMessage = ErrorMessage + "Document Type Cannot Be Blank.<br>";
                }
                if (SEWB_Doc_Date.Text.Length != 11)
                {
                    ErrorMessage = ErrorMessage + "Invalid Vendor Document Date.<br>";
                }
                if (SEWB_TranspoterName.Text.Length == 0)
                {
                    ErrorMessage = ErrorMessage + "Transporter Name Cannot be Blank.<br>";
                }
                if (SEWB_TransporterID.Text.Length == 0)
                {
                    ErrorMessage = ErrorMessage + "TransporterId Cannot be Blank.<br>";
                }
                if (SEWB_Distance.Text.Length == 0)
                {
                    ErrorMessage = ErrorMessage + "Distance should be more than 100 km.<br>";
                }
                if (SEWB_Trn_SubDesc.Text.Length == 0)
                {
                    ErrorMessage = ErrorMessage + "SubDiscription be Blank.<br>";
                }


                if (ddlSEWB_Trans_Mode.SelectedIndex == 0)
                {
                    ErrorMessage = ErrorMessage + "Mode Of Transaction can not be blank<br>";
                }
                if (SEWB_Trans_Doc_No.Text.Length == 0)
                {
                    ErrorMessage = ErrorMessage + "Transaction doc no can not be blank<br>";
                }

                if (SEWB_Trans_Doc_Date.Text.Length != 11)
                {
                    ErrorMessage = ErrorMessage + "Invalid Transporter Doc Date.<br>";
                }

                if (SEWB_ShippTo_State_ID.SelectedIndex == 0)
                {
                    ErrorMessage = ErrorMessage + "Select Supplier Place Of Supply<br>";
                }
                if (SEWB_ShippFrom_State_ID.SelectedIndex == 0)
                {
                    ErrorMessage = ErrorMessage + "Select Recipient Place Of Supply<br>";
                }


                if ((ddlSEWB_Trn_Type.Text.Length > 0) && (Fk_VendorID.SelectedIndex > 0))
                {
                    if (SQLManager.CheckDuplicateRecord("v_M_AT_Sales_SEWB_AHDR", "SEWB_HDR_ID", Convert.ToInt32("0" + SEWB_HDR_ID.Text), "SINV_No", ddlSEWB_Trn_Type.Text,
                                                        " AND Fk_Branch_ID=" + SessionUserData.Company.BranchID + " AND  Fk_VendorID=" + Fk_VendorID.Text))
                    {
                        ErrorMessage = ErrorMessage + "Vendor Purchase Invoice Already Exist.<br>";
                    }
                }


                if ((Fk_VendorID.SelectedIndex > 0) && (Convert.ToInt32(SEWB_HDR_ID.Text) == 0))
                {
                    if (ddlSEWB_Trans_Mode.SelectedIndex == 0)
                    {
                        ErrorMessage = ErrorMessage + "Mode Of Transaction can not be blank<br>";
                    }
                    if (SEWB_Trans_Doc_No.Text.Length == 0)
                    {
                        ErrorMessage = ErrorMessage + "Mode Of Transaction can not be blank<br>";
                    }

                    if (SEWB_Trans_Doc_Date.Text.Length != 11)
                    {
                        ErrorMessage = ErrorMessage + "Invalid Vendor Transporter Doc Date Date.<br>";
                    }

                    else
                    {
                    }
                }
                if ((Convert.ToInt32(SEWB_HDR_ID.Text) > 0) && (Convert.ToInt32(SEWB_CTL_ID.Text) > 0) && (DDlVehicle.SelectedIndex > 0))

                {
                    if (ddlSEWB_Trans_Mode.SelectedIndex == 0)
                    {
                        ErrorMessage = ErrorMessage + "Mode Of Transaction can not be blank<br>";
                    }
                    if (SEWB_Trans_Doc_No.Text.Length == 0)
                    {
                        ErrorMessage = ErrorMessage + "Mode Of Transaction can not be blank<br>";
                    }

                    if (SEWB_Trans_Doc_Date.Text.Length != 11)
                    {
                        ErrorMessage = ErrorMessage + "Invalid Vendor Transporter Doc Date Date.<br>";
                    }
                    if (DDlVehicle.SelectedValue.Length == 0)
                    {
                        ErrorMessage = ErrorMessage + "Select Vehicle Type.<br>";
                    }
                    else
                    {
                    }
                }


                if (ErrorMessage.Length == 0)
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        if (Convert.ToInt32(SEWB_HDR_ID.Text) == 0)
                        {
                            ObjAT_SEWB_HDR.MDBSC_RowCreatedByUserName = SessionUserData.UserData.UserName;
                            ObjAT_SEWB_HDR.MDBSC_RowCreatedByUser_ID  = SessionUserData.UserData.UserID;
                        }
                        SetValuesToBO_HDR();
                        ErrorMessage     = ObjAT_SEWB_HDR.Insert_Update(ObjAT_SEWB_HDR);
                        SEWB_HDR_ID.Text = ErrorMessage.Substring((ErrorMessage.IndexOf("|") + 1), (ErrorMessage.Length - ErrorMessage.IndexOf("|") - 1));
                        ErrorMessage     = ErrorMessage.Substring((0), (ErrorMessage.IndexOf("|")));

                        if ((Convert.ToInt32(SEWB_HDR_ID.Text) > 0) && (DDlVehicle.SelectedIndex >= 0))
                        {
                            if (Convert.ToInt32(SEWB_CTL_ID.Text) == 0)
                            {
                                ObjAT_SEWB_DTL.MDBSC_RowCreatedByUser_ID  = SessionUserData.UserData.UserID;
                                ObjAT_SEWB_DTL.MDBSC_RowCreatedByUserName = SessionUserData.UserData.UserName;
                            }

                            ObjAT_SEWB_TDTL.SEWB_CTL_ID             = Convert.ToInt64("0" + SEWB_CTL_ID.Text);
                            ObjAT_SEWB_TDTL.Fk_SEWB_HDR_ID          = Convert.ToInt64("0" + SEWB_HDR_ID.Text);
                            ObjAT_SEWB_TDTL.SEWB_Trans_Mode         = ddlSEWB_Trans_Mode.SelectedValue;
                            ObjAT_SEWB_TDTL.SEWB_Vehicle_Type       = DDlVehicle.SelectedValue;
                            ObjAT_SEWB_TDTL.SEWB_Vehicle_No         = SEWB_Vehicle_No.Text;
                            ObjAT_SEWB_TDTL.SEWB_Trans_Doc_No       = SEWB_Trans_Doc_No.Text;
                            ObjAT_SEWB_TDTL.SEWB_Trans_Doc_Date     = SEWB_Trans_Doc_Date.Text;
                            ObjAT_SEWB_DTL.SEWB_CGST_ID             = 0;
                            ObjAT_SEWB_DTL.SEWB_SGST_ID             = 0;
                            ObjAT_SEWB_DTL.SEWB_IGST_ID             = 0;
                            ObjAT_SEWB_DTL.SEWB_CESS_ID             = 0;
                            ObjAT_SEWB_TDTL.MDBSC_RowLupdnByUser_ID = SessionUserData.UserData.UserID;
                            ObjAT_SEWB_TDTL.MDBSC_RowLupdnUserName  = SessionUserData.UserData.UserName;
                            ObjAT_SEWB_TDTL.MDBSC_RowLupdnOn_DT     = DateHelper.ConvertToDataBase(DateHelper.ConvertToForm(DateTime.Now));

                            ObjAT_SEWB_TDTL.Insert_Update(ObjAT_SEWB_TDTL);
                        }

                        scope.Complete();
                    }
                    if (Convert.ToInt32("0" + SEWB_HDR_ID.Text) > 0)
                    {
                        MABL.SQLManager.SQLProcedureCall.USP_Update_Tbl_EWayBill(SessionUserData.Company.CompanyID, SessionUserData.Company.BranchID, SessionUserData.Company.YearID, Convert.ToInt32(SEWB_HDR_ID.Text));
                        SetValueToControls_Edit_HDR(Convert.ToInt32("0" + SEWB_HDR_ID.Text));
                    }


                    // DisplayCustomMessageSummary(ErrorMessage);
                }
                else
                {
                    // DisplayCustomMessageSummary(ErrorMessage);
                }
                Msg_ErrorMsg.Text = ErrorMessage;
            }
            catch (Exception ex)
            {
                DisplayCustomMessageSummary("Failed Save Data");
            }
        }
Ejemplo n.º 33
0
 public BaseController()
 {
     this.dataManager = new SQLManager <T>(DataConnectionResource.LOCALMSSQLSERVER);
 }
Ejemplo n.º 34
0
        public StudentCheckResponse Post([FromBody] StudentCheckRequest req)
        {
            StudentCheckResponse resp = new StudentCheckResponse();

            try
            {
                MySqlConnection conn = SQLManager.getConn(); //连接数据库
                conn.Open();                                 //打开数据库连接
                MySqlCommand cmd = null;                     //sql语句
                cmd = new MySqlCommand("select " +
                                       "student_name, Gender, department, grade, class_num, dorm_num, healthcode_color, " +
                                       "contact_way, emergency_contact, currenthealth_status " +
                                       "from student where student_ID = @id;", conn);
                cmd.Parameters.AddWithValue("@id", req.id); //绑定参数
                MySqlDataReader mdr = cmd.ExecuteReader();
                if (!mdr.HasRows)                           //查询无结果
                {
                    resp.result = "wrong id";
                }
                else  //查询成功
                {
                    mdr.Read();
                    resp.name = mdr[0].ToString();
                    int gen = Convert.ToInt32(mdr.GetValue(1));
                    resp.gender     = gen == 0 ? "男" : "女";
                    resp.department = mdr[2].ToString();
                    resp.grade      = mdr[3].ToString();
                    resp.classnum   = mdr[4].ToString();
                    resp.dorm       = mdr[5].ToString();
                    string color = mdr[6].ToString();
                    switch (color)
                    {
                    case "green":
                        resp.healthcodecolor = "绿色";
                        break;

                    case "red":
                        resp.healthcodecolor = "红色";
                        break;

                    case "yellow":
                        resp.healthcodecolor = "黄色";
                        break;
                    }
                    resp.telephone      = mdr[7].ToString();
                    resp.emergencyphone = mdr[8].ToString();
                    int health = Convert.ToInt32(mdr.GetValue(9));
                    switch (health)
                    {
                    case 0:
                        resp.healthstatus = "健康";
                        break;

                    case 1:
                        resp.healthstatus = "发热";
                        break;

                    case 2:
                        resp.healthstatus = "疑似";
                        break;

                    case 3:
                        resp.healthstatus = "确诊";
                        break;
                    }
                    resp.result = "success";
                }
                mdr.Close();
                conn.Close();//关闭连接
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                resp.result = "fail";
            }
            return(resp);
        }
Ejemplo n.º 35
0
        public static List <ModeloDTO> getAllModelos()
        {
            SqlDataReader reader = SQLManager.executeProcedureList("getModelos");

            return(readerToListModelos(reader));
        }
Ejemplo n.º 36
0
        private void darDeBajaRuta(int idRuta)
        {
            SQLManager sqlManager = new SQLManager().generarSP("BajaRuta")
                                                    .agregarIntSP("@IdRuta", idRuta);

            try
            {
                sqlManager.ejecutarSP();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error al dar de baja", MessageBoxButtons.OK);
                return;
            }
            MessageBox.Show("Se realizo la baja correctamente", "Informe", MessageBoxButtons.OK);
        }
Ejemplo n.º 37
0
        //SAVE
        public static string CU_Mst_Vendor(M_AT_Mst_VendorBO mvObjVen)
        {
            M_AT_Mst_VendorBO ObjAT_Ven        = new M_AT_Mst_VendorBO();
            string            strRetMst        = "";
            DataTable         dt               = new DataTable();
            string            var_ErrorMessage = "";

            try
            {
                if (mvObjVen.MVen_RegType.Length == 0)
                {
                    var_ErrorMessage = var_ErrorMessage + "Pls Select Vendor Type<br>";
                }
                if (SQLManager.CheckDuplicateRecord("M_AT_Mst_Vendor", "M_Ven_ID", mvObjVen.M_Ven_ID, "MVenCode", mvObjVen.MVen_Code, ""))
                {
                    var_ErrorMessage = var_ErrorMessage + "Vendor Code Already Exist.<br>";
                }

                if (SQLManager.CheckDuplicateRecord("M_AT_Mst_Vendor", "M_Ven_ID", mvObjVen.M_Ven_ID, "MVen_Name", mvObjVen.MVen_Name, ""))
                {
                    var_ErrorMessage = var_ErrorMessage + "Vendor Name Already Exists.<br>";
                }

                if (mvObjVen.MVen_Code.Length == 0)
                {
                    var_ErrorMessage = var_ErrorMessage + "Vendor Code No Cannot Be Blank.<br>";
                }

                if (mvObjVen.MVen_Name.Length == 0)
                {
                    var_ErrorMessage = var_ErrorMessage + "Vendor Name Cannot Be Blank.<br>";
                }
                if (mvObjVen.MVen_TradeName.Length == 0)
                {
                    var_ErrorMessage = var_ErrorMessage + "Vendor Trade Name Cannot Be Blank.<br>";
                }

                if (mvObjVen.MVen_Reg_State_ID == 0)
                {
                    var_ErrorMessage = var_ErrorMessage + "Select Customer State.<br>";
                }

                if (mvObjVen.MVen_DispatchFrom_State_ID == 0)
                {
                    var_ErrorMessage = var_ErrorMessage + "Select Customer Shipp To State.<br>";
                }


                if (var_ErrorMessage.Length == 0)
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        if (Convert.ToInt32(mvObjVen.M_Ven_ID) == 0)
                        {
                            ObjAT_Ven.Fk_Company_ID              = mvObjVen.Fk_Company_ID;
                            ObjAT_Ven.Fk_Branch_ID               = mvObjVen.Fk_Branch_ID;
                            ObjAT_Ven.Fk_Year_ID                 = mvObjVen.Fk_Year_ID;
                            ObjAT_Ven.MDBSC_RowCreatedByUser_ID  = mvObjVen.MDBSC_RowCreatedByUser_ID;
                            ObjAT_Ven.MDBSC_RowCreatedByUserName = mvObjVen.MDBSC_RowCreatedByUserName;
                            ObjAT_Ven.MVen_Code = MaheshAF18.Application.MEF.GenrateRefNo(mvObjVen.Fk_Company_ID, mvObjVen.Fk_Branch_ID, 0, "Vendor", "Ven", "Ven", "No", "", "", "", 0);
                        }


                        ObjAT_Ven.M_Ven_ID         = mvObjVen.M_Ven_ID;
                        ObjAT_Ven.MVen_Name        = mvObjVen.MVen_Name;
                        ObjAT_Ven.MVen_DisplayName = mvObjVen.MVen_DisplayName;
                        ObjAT_Ven.MVen_TradeName   = mvObjVen.MVen_TradeName;
                        ObjAT_Ven.MVen_RegType     = mvObjVen.MVen_RegType;
                        ObjAT_Ven.MVen_CreditDays  = mvObjVen.MVen_CreditDays;


                        ObjAT_Ven.MVen_Reg_Add1     = mvObjVen.MVen_Reg_Add1;
                        ObjAT_Ven.MVen_Reg_Add2     = mvObjVen.MVen_Reg_Add2;
                        ObjAT_Ven.MVen_Reg_Pincode  = mvObjVen.MVen_Reg_Pincode;
                        ObjAT_Ven.MVen_Reg_City     = mvObjVen.MVen_Reg_City;
                        ObjAT_Ven.MVen_Reg_State_ID = mvObjVen.MVen_Reg_State_ID;
                        ObjAT_Ven.MVen_Reg_Country  = mvObjVen.MVen_Reg_Country;
                        ObjAT_Ven.MVen_BL_PANNO     = mvObjVen.MVen_BL_PANNO;
                        ObjAT_Ven.MVen_BL_GSTNO     = mvObjVen.MVen_BL_GSTNO;

                        ObjAT_Ven.MVen_Primary_Contact_Person = mvObjVen.MVen_Primary_Contact_Person;
                        ObjAT_Ven.MVen_Primary_CP_MobileNo    = mvObjVen.MVen_Primary_CP_MobileNo;
                        ObjAT_Ven.MVen_Primary_CP_PhoneNo     = mvObjVen.MVen_Primary_CP_PhoneNo;
                        ObjAT_Ven.MVen_Primary_CP_EmailID     = mvObjVen.MVen_Primary_CP_EmailID;



                        ObjAT_Ven.MVen_DispatchFrom_CompanyName   = mvObjVen.MVen_DispatchFrom_CompanyName;
                        ObjAT_Ven.MVen_DispatchFrom_ContactPerson = mvObjVen.MVen_DispatchFrom_ContactPerson;
                        ObjAT_Ven.MVen_DispatchFrom_CP_MobileNo   = mvObjVen.MVen_DispatchFrom_CP_MobileNo;


                        ObjAT_Ven.MVen_DispatchFrom_Add1 = mvObjVen.MVen_DispatchFrom_Add1;
                        ObjAT_Ven.MVen_DispatchFrom_Add2 = mvObjVen.MVen_DispatchFrom_Add2;

                        ObjAT_Ven.MVen_DispatchFrom_Pincode = mvObjVen.MVen_DispatchFrom_Pincode;

                        ObjAT_Ven.MVen_DispatchFrom_City     = mvObjVen.MVen_DispatchFrom_City;
                        ObjAT_Ven.MVen_DispatchFrom_State_ID = mvObjVen.MVen_DispatchFrom_State_ID;
                        ObjAT_Ven.MVen_DispatchFrom_Country  = mvObjVen.MVen_DispatchFrom_Country;
                        ObjAT_Ven.MVen_DispatchFrom_PANNO    = mvObjVen.MVen_DispatchFrom_PANNO;
                        ObjAT_Ven.MVen_DispatchFrom_GSTNO    = mvObjVen.MVen_DispatchFrom_GSTNO;

                        ObjAT_Ven.MDBSC_RowStatus = mvObjVen.MDBSC_RowStatus;



                        ObjAT_Ven.MDBSC_RowLupdnByUser_ID = mvObjVen.MDBSC_RowLupdnByUser_ID;
                        ObjAT_Ven.MDBSC_RowLupdnUserName  = mvObjVen.MDBSC_RowLupdnUserName;
                        ObjAT_Ven.MDBSC_RowLupdnOn_DT     = DateHelper.ConvertToDataBase(DateHelper.ConvertToForm(DateTime.Now));


                        ObjAT_Ven.MVen_Contact_FaxNo               = mvObjVen.MVen_Contact_FaxNo;
                        ObjAT_Ven.MVen_Contact_OfficeNo1           = mvObjVen.MVen_Contact_OfficeNo1;
                        ObjAT_Ven.MVen_Contact_OfficeNo2           = mvObjVen.MVen_Contact_OfficeNo2;
                        ObjAT_Ven.MVen_Contact_Email_Admin         = mvObjVen.MVen_Contact_Email_Admin;
                        ObjAT_Ven.MVen_Contact_Website             = mvObjVen.MVen_Contact_Website;
                        ObjAT_Ven.MVen_Primary_Contact_Designation = mvObjVen.MVen_Primary_Contact_Designation;



                        var_ErrorMessage = ObjAT_Ven.Insert_Update(ObjAT_Ven);
                        //ObjItem.MItem_ID =Convert.ToInt64( var_ErrorMessage.Substring((var_ErrorMessage.IndexOf("|") + 1), (var_ErrorMessage.Length - var_ErrorMessage.IndexOf("|") - 1)));
                        //var_ErrorMessage = var_ErrorMessage.Substring((0), (var_ErrorMessage.IndexOf("|")));
                        scope.Complete();
                    }
                    strRetMst = var_ErrorMessage;
                }
                else
                {
                    strRetMst = var_ErrorMessage + "|" + mvObjVen.M_Ven_ID.ToString();
                }


                return(strRetMst);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 38
0
 public void Finalise()
 {
     SQLManager.ResetDatabase();
 }
Ejemplo n.º 39
0
    /// <summary>
    /// 일일퀘스트를 갱신합니다.
    /// </summary>
    /// <param name="AUID"></param>
    /// <param name="QuestCode1"></param>
    /// <param name="QuestCode2">여러 개를 갱신할 때 입력.</param>
    /// <param name="QuestCode3">여러 개를 갱신할 때 입력.</param>
    static public void UpdateDailyQuest(int AUID, string QuestCode1, string QuestCode2 = null, string QuestCode3 = null)
    {
        int maxQuest = 3;

        string[] QuestCode = new string[maxQuest];
        int[]    oldCount  = new int[maxQuest];
        int[]    newCount  = new int[maxQuest];
        int[]    cutLine   = new int[maxQuest];
        int[]    Complete  = new int[maxQuest];
        int      index     = 0;

        string        SQL    = string.Format("select * from UserDailyQuest where AUID='{0}' and (QuestCode='{1}' or QuestCode='{2}' or QuestCode='{3}')", AUID, QuestCode1, QuestCode2, QuestCode3);
        SqlDataReader reader = SQLManager.ExecuteReader(SQL);

        CSVReader excel = null;

        if (reader.HasRows)
        {
            while (reader.Read())
            {
                QuestCode[index] = reader["QuestCode"].ToString();
                Complete[index]  = int.Parse(reader["Complete"].ToString());

                if (Complete[index] == 0)
                {
                    if (excel == null)
                    {
                        excel = new CSVReader("TbQuest.txt");
                    }

                    oldCount[index] = int.Parse(reader["Count"].ToString());
                    newCount[index] = oldCount[index] + 1;

                    cutLine[index] = int.Parse(ReadJSONData.ReadLine(excel.FindJSONData("QuestCode", QuestCode[index]))[3]);

                    //Debug.Log(CodeManager.GetMethodName() + AUID + " : " + QuestCode[index]);
                }

                index++;
            }
        }
        reader.Close();

        for (int i = 0; i < index; i++)
        {
            if (Complete[i] == 0)
            {
                if (newCount[i] >= cutLine[i])
                {
                    newCount[i] = cutLine[i];

                    SQL    = string.Format("update UserDailyQuest set Count='{0}', Complete='1' where AUID='{1}' and QuestCode='{2}'", newCount[i], AUID, QuestCode[i]);
                    reader = SQLManager.ExecuteReader(SQL);

                    reader.Close();

                    SQL    = string.Format("insert into UserDailyQuestCompleteNotice values ('{0}','{1}');", AUID, QuestCode[i]);
                    reader = SQLManager.ExecuteReader(SQL);

                    reader.Close();

                    if (showLog)
                    {
                        Debug.Log(CodeManager.GetMethodName() + AUID + " : " + QuestCode[i] + " 가 갱신되어서 커트라인을 달성했다.");
                    }
                }
                else
                {
                    SQL    = string.Format("update UserDailyQuest set Count='{0}' where AUID='{1}' and QuestCode='{2}'", newCount[i], AUID, QuestCode[i]);
                    reader = SQLManager.ExecuteReader(SQL);

                    reader.Close();

                    if (showLog)
                    {
                        Debug.Log(CodeManager.GetMethodName() + AUID + " : " + QuestCode[i] + " 가 갱신되었다.");
                    }
                }
            }
            else
            {
                if (showLog)
                {
                    Debug.Log(CodeManager.GetMethodName() + AUID + " : " + QuestCode[i] + " 는 이미 커트라인을 달성했다.");
                }
            }
        }
    }
Ejemplo n.º 40
0
    /// <summary>
    /// 에너지의 자연 회복을 갱신한다.
    /// </summary>
    /// <param name="AUID"></param>
    public void RefreshEnergy(int AUID)
    {
        isEnergyUp  = false;
        finalEnergy = -1;

        int userLevel  = -1;
        int userEnergy = -1;

        string        SQL    = string.Format("select * from UserInfo where AUID='{0}'", AUID);
        SqlDataReader reader = SQLManager.ExecuteReader(SQL);

        if (reader.HasRows)
        {
            reader.Read();

            userLevel  = int.Parse(reader["Level"].ToString());
            userEnergy = int.Parse(reader["Energy"].ToString());
        }

        reader.Close();

        cutLine = userLevel + 49;

        SQL    = string.Format("select * from Setting");
        reader = SQLManager.ExecuteReader(SQL);

        if (reader.HasRows)
        {
            reader.Read();
            MaxEnergy  = int.Parse(reader["MaxEnergy"].ToString());
            EnergyTime = int.Parse(reader["EnergyTime"].ToString());
        }

        reader.Close();

        SQL    = "select convert(varchar(30), getdate(), 121) as currentTime";
        reader = SQLManager.ExecuteReader(SQL);
        reader.Read();

        // 현재 시각.
        DateTime cTime = Convert.ToDateTime(reader["currentTime"].ToString());

        reader.Close();

        SQL    = string.Format("select * from UserEnergyTime where AUID='{0}'", AUID);
        reader = SQLManager.ExecuteReader(SQL);

        if (reader.HasRows)
        {
            reader.Read();

            // 1 회복까지 남은 시간.
            lastTime = double.Parse(reader["LastTime"].ToString());

            // 마지막으로 에너지가 변경된 시각.
            refreshTime = Convert.ToDateTime(reader["RefreshTime"].ToString());

            reader.Close();

            // 현재 시각 - 마지막으로 에너지가 변경된 시각 : 회복을 적용해야 하는 시간.
            TimeSpan ss = cTime.Subtract(refreshTime);
            double   ts = ss.TotalMilliseconds;

            if (showJsonLog)
            {
                Debug.Log(CodeManager.GetMethodName() + AUID + " : " + ts / 1000 + " / refreshTime : " + refreshTime);
            }

            if (ts < EnergyTime)
            {
                // 회복은 없다.
                if (userEnergy < userLevel + 49)
                {
                    lastTime = EnergyTime - ts;

                    SQL = string.Format("update UserEnergyTime set LastTime='{0}' where AUID='{1}'", lastTime - lastTime % 1, AUID);
                    SQLManager.ExecuteNonQuery(SQL);

                    if (showJsonLog)
                    {
                        Debug.Log(CodeManager.GetMethodName() + AUID + " : " + "1 회복까지 앞으로 " + ((lastTime - lastTime % 1) / 1000) + " 초.");
                    }
                }
            }
            else
            {
                // 에너지를 회복시킨다.
                bool isIncreaseEnergy = false;

                while (ts >= EnergyTime)
                {
                    ts -= EnergyTime;

                    if (userEnergy < userLevel + 49)
                    {
                        userEnergy++;

                        isIncreaseEnergy = true;
                        isEnergyUp       = true;

                        if (showJsonLog)
                        {
                            Debug.Log(CodeManager.GetMethodName() + AUID + " : " + "에너지 1 회복 : " + userEnergy + " / " + ts / 1000);
                        }
                    }

                    if (userEnergy >= userLevel + 49)
                    {
                        ts = -1;

                        break;
                    }
                }

                if (isIncreaseEnergy)
                {
                    SQL = string.Format("update UserInfo set Energy='{0}' where AUID='{1}'", userEnergy, AUID);
                    SQLManager.ExecuteNonQuery(SQL);

                    if (ts > -1)
                    {
                        lastTime = EnergyTime - ts;

                        if (showJsonLog)
                        {
                            Debug.Log(CodeManager.GetMethodName() + AUID + " : " + "1 회복까지 앞으로 " + ((lastTime - lastTime % 1) / 1000) + " 초.");
                        }
                    }
                    else
                    {
                        lastTime = -1;

                        if (showJsonLog)
                        {
                            Debug.Log(CodeManager.GetMethodName() + AUID + " : " + "에너지가 만땅이 되었다!!");
                        }
                    }
                    //getdate() - (EnergyTime - lastTime)
                    // DATEADD(millisecond, {1}, getdate())
                    // RefreshTime 은 현재 시각이 아니라 마지막으로 회복이 되는 시점을 넣어야 한다.
                    SQL = string.Format("update UserEnergyTime set LastTime='{0}', RefreshTime=convert(varchar(30), DATEADD(millisecond, {1}, getdate()), 121) where AUID='{2}'", lastTime - lastTime % 1, -(EnergyTime - lastTime), AUID);
                    //SQL = string.Format("update UserEnergyTime set LastTime='{0}', RefreshTime=convert(varchar(30), getdate(), 121) where AUID='{1}'", lastTime - lastTime % 1, AUID);
                    SQLManager.ExecuteNonQuery(SQL);
                }
                else
                {
                    // 이미 만땅이라서 회복이 되지 않았다.
                    SQL = string.Format("update UserEnergyTime set LastTime='{0}' where AUID='{1}'", -1, AUID);
                    SQLManager.ExecuteNonQuery(SQL);

                    if (showJsonLog)
                    {
                        Debug.Log(CodeManager.GetMethodName() + AUID + " : " + "이미 만땅이라서 회복이 되지 않았다.");
                    }
                }
            }
        }

        finalEnergy = userEnergy;

        reader.Close();
    }
Ejemplo n.º 41
0
        public void OnActionExecuting(ActionExecutingContext filterContext)
        {
            SQLManager manager = new SQLManager();

            filterContext.Controller.ViewBag.userName = manager.SelectStudentName(filterContext.HttpContext.User.Identity.Name);
        }
Ejemplo n.º 42
0
    /// <summary>
    /// 에너지 변경으로 인한 시간 계산을 시작하거나 끝낸다.
    /// </summary>
    /// <param name="AUID"></param>
    /// <param name="isLevelup"></param>
    /// <param name="userLevel"></param>
    /// <param name="oldEnergy"></param>
    /// <param name="newEnergy"></param>
    public void EnergyChanged(int AUID, bool isLevelup, int userLevel, int oldEnergy, ref int newEnergy)
    {
        cutLine = userLevel + 49;

        //SQLManager.DBOpen();

        string        SQL    = string.Format("select * from Setting");
        SqlDataReader reader = SQLManager.ExecuteReader(SQL);

        if (reader.HasRows)
        {
            reader.Read();
            MaxEnergy  = int.Parse(reader["MaxEnergy"].ToString());
            EnergyTime = int.Parse(reader["EnergyTime"].ToString());
        }

        reader.Close();

        SQL    = string.Format("select * from UserEnergyTime where AUID='{0}'", AUID);
        reader = SQLManager.ExecuteReader(SQL);

        if (reader.HasRows)
        {
            reader.Read();
            lastTime = double.Parse(reader["LastTime"].ToString());
        }

        reader.Close();

        if (oldEnergy > newEnergy)
        {
            // 에너지가 감소했다.
            if (showJsonLog)
            {
                Debug.Log(CodeManager.GetMethodName() + "에너지가 감소했다.");
            }

            if (isLevelup)
            {
                // 레벨업을 했는데 에너지가 커트라인보다 낮으면 커트라인까지 회복시킨다.
                if (newEnergy < cutLine)
                {
                    newEnergy = cutLine;
                }

                // 레벨업을 했는데 초기 에너지가 커트라인보다 높으면 유지시킨다.
                if (oldEnergy > cutLine)
                {
                    newEnergy = oldEnergy;
                }
            }

            if (newEnergy >= cutLine)
            {
                // 최종 에너지가 커트라인 이상이면 계산을 중지한다.
                // 레벨업을 했으면 여기로 온다.
                lastTime = -1;
            }
            else
            {
                if (oldEnergy >= cutLine)
                {
                    // 이제부터 계산을 시작한다.
                    lastTime = EnergyTime;

                    SQL = string.Format("update UserEnergyTime set LastTime='{0}', RefreshTime=convert(varchar(30), getdate(), 121) where AUID='{1}'", lastTime, AUID);
                    SQLManager.ExecuteNonQuery(SQL);

                    if (showJsonLog)
                    {
                        Debug.Log(CodeManager.GetMethodName() + oldEnergy + " -> " + newEnergy + " / lastTime : " + lastTime);
                    }
                }
            }
        }
        else if (oldEnergy < newEnergy)
        {
            // 에너지가 증가했다.
            if (showJsonLog)
            {
                Debug.Log(CodeManager.GetMethodName() + "에너지가 증가했다.");
            }

            if (newEnergy > MaxEnergy)
            {
                newEnergy = MaxEnergy;
            }

            if (newEnergy >= cutLine)
            {
                // 최종 에너지가 커트라인 이상이면 계산을 중지한다.
                lastTime = -1;

                SQL = string.Format("update UserEnergyTime set LastTime='{0}' where AUID='{1}'", lastTime, AUID);
                SQLManager.ExecuteNonQuery(SQL);

                if (showJsonLog)
                {
                    Debug.Log(CodeManager.GetMethodName() + oldEnergy + " -> " + newEnergy + " / lastTime : " + lastTime);
                }
            }
        }

        //SQLManager.DBClose();
    }
Ejemplo n.º 43
0
        protected void btnsave_Click(object sender, System.EventArgs e)
        {
            try
            {
                string var_GSTState  = "";
                string var_StateCode = "";
                if (MVen_RegType.SelectedIndex == 0)
                {
                    ErrorMessage = ErrorMessage + "Pls Select Vendor Type<br>";
                }
                else
                {
                    if ((MVen_RegType.Text == "Registered Taxpayer") || (MVen_RegType.Text == "Composite Taxpayer"))
                    {
                        if (MVen_BL_GSTNO.Text.Length != 15)
                        {
                            ErrorMessage = ErrorMessage + "Billing GST No Cannot Be Blank<br>";
                        }
                        if (MVen_DispatchFrom_GSTNO.Text.Length != 15)
                        {
                            ErrorMessage = ErrorMessage + "Consigner GST No Cannot Be Blank<br>";
                        }

                        if (MVen_Reg_State_ID.SelectedIndex > 0)
                        {
                            if (MVen_BL_GSTNO.Text.Length > 2)
                            {
                                var_GSTState = MVen_BL_GSTNO.Text.Substring(0, 2);
                            }

                            var_StateCode = MVen_Reg_State_ID.SelectedItem.Text.Substring(0, 2);
                            if (var_GSTState != var_StateCode)
                            {
                                ErrorMessage = ErrorMessage + "Invlid Billing GST No For " + MVen_Reg_State_ID.SelectedItem.Text + " .<br>";
                            }
                        }


                        if (MVen_DispatchFrom_State_ID.SelectedIndex > 0)
                        {
                            if (MVen_DispatchFrom_GSTNO.Text.Length > 2)
                            {
                                var_GSTState = MVen_DispatchFrom_GSTNO.Text.Substring(0, 2);
                            }

                            var_StateCode = MVen_DispatchFrom_State_ID.SelectedItem.Text.Substring(0, 2);
                            if (var_GSTState != var_StateCode)
                            {
                                ErrorMessage = ErrorMessage + "Invlid Consigner GST No For " + MVen_DispatchFrom_State_ID.SelectedItem.Text + " .<br>";
                            }
                        }
                    }

                    if (MVen_RegType.Text == "Unregistered")
                    {
                    }
                }

                if (SQLManager.CheckDuplicateRecord("M_AT_Mst_Vendor", "M_Ven_ID", Convert.ToInt32("0" + M_Ven_ID.Text), "MVenCode", MVen_Code.Text, ""))
                {
                    ErrorMessage = ErrorMessage + "Vendor Code Already Exist.<br>";
                }

                if (SQLManager.CheckDuplicateRecord("M_AT_Mst_Vendor", "M_Ven_ID", Convert.ToInt32("0" + M_Ven_ID.Text), "MVenName", MVen_Name.Text, ""))
                {
                    ErrorMessage = ErrorMessage + "Vendor Name Already Exists.<br>";
                }

                if (MVen_Code.Text.Length == 0)
                {
                    ErrorMessage = ErrorMessage + "Vendor Code No Cannot Be Blank.<br>";
                }

                if (MVen_Name.Text.Length == 0)
                {
                    ErrorMessage = ErrorMessage + "Vendor Name Cannot Be Blank.<br>";
                }
                if (MVen_TradeName.Text.Length == 0)
                {
                    ErrorMessage = ErrorMessage + "Vendor Trade Name Cannot Be Blank.<br>";
                }
                if (MVen_Reg_State_ID.SelectedIndex == 0)
                {
                    ErrorMessage = ErrorMessage + "Select Vendor State.<br>";
                }

                if (MVen_DispatchFrom_State_ID.SelectedIndex == 0)
                {
                    ErrorMessage = ErrorMessage + "Select Vendor Shipp To State.<br>";
                }

                if (ErrorMessage.Length == 0)
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        if (Convert.ToInt32(M_Ven_ID.Text) == 0)
                        {
                            ObjAT_Ven.Fk_Company_ID              = SessionUserData.Company.CompanyID;
                            ObjAT_Ven.Fk_Branch_ID               = SessionUserData.Company.BranchID;
                            ObjAT_Ven.Fk_Year_ID                 = SessionUserData.Company.YearID;
                            ObjAT_Ven.MDBSC_RowCreatedByUser_ID  = SessionUserData.UserData.UserID;
                            ObjAT_Ven.MDBSC_RowCreatedByUserName = SessionUserData.UserData.UserName;
                            ObjAT_Ven.MVen_Code = MaheshAF18.Application.MEF.GenrateRefNo(SessionUserData.Company.CompanyID,
                                                                                          SessionUserData.Company.BranchID, 0, "Vendor", "VEN", "VEN", "No", "", "", "", 0);
                        }
                        SetValuesToBO();
                        ErrorMessage  = ObjAT_Ven.Insert_Update(ObjAT_Ven);
                        M_Ven_ID.Text = ErrorMessage.Substring((ErrorMessage.IndexOf("|") + 1), (ErrorMessage.Length - ErrorMessage.IndexOf("|") - 1));
                        ErrorMessage  = ErrorMessage.Substring((0), (ErrorMessage.IndexOf("|")));
                        scope.Complete();
                    }

                    SetValueToControls_Edit(Convert.ToInt64(M_Ven_ID.Text));
                    DisplayCustomMessageSummary(ErrorMessage);
                }
                else
                {
                    DisplayCustomMessageSummary(ErrorMessage);
                }
            }
            catch (Exception ex)
            {
                DisplayCustomMessageSummary("Failed Save Data");
            }
        }
Ejemplo n.º 44
0
        protected void btnClear_Click(object sender, EventArgs e)
        {
            int      reqID  = -1;
            int      brID   = -1;
            int      years  = -1;
            int      frID   = -1;
            int      uID    = -1;
            string   msg    = "Your License renewal request has been denied";
            DateTime expiry = DateTime.Now;

            foreach (GridViewRow gvrow in gvRequests.Rows)
            {
                CheckBox chk = (CheckBox)gvrow.FindControl("cbSelect");
                if (chk != null && chk.Checked)
                {
                    reqID = Convert.ToInt32(gvrow.Cells[1].Text);
                    var    cs         = ConfigurationManager.ConnectionStrings["ZoomDB"];
                    string connection = cs.ConnectionString;

                    SqlConnection  sqlconnect = new SqlConnection(connection);
                    SqlDataAdapter adapt      = new SqlDataAdapter("Select * from renewalRequests", sqlconnect);
                    DataSet        dsReq      = new DataSet();

                    adapt.Fill(dsReq, "renewalRequests");
                    DataTable tblReq;
                    tblReq = dsReq.Tables["renewalRequests"];


                    foreach (DataRow row in tblReq.Rows)
                    {
                        if (reqID == Convert.ToInt32(row["id"].ToString()))
                        {
                            brID  = Convert.ToInt32(row["brID"]);
                            years = Convert.ToInt32(row["years"]);
                            break;
                        }
                    }



                    adapt = new SqlDataAdapter("Select * from franchise", sqlconnect);
                    dsReq = new DataSet();

                    adapt.Fill(dsReq, "franchise");
                    tblReq = dsReq.Tables["franchise"];


                    foreach (DataRow row in tblReq.Rows)
                    {
                        if (brID == Convert.ToInt32(row["BRANCH_ID"].ToString()))
                        {
                            frID   = Convert.ToInt32(row["id"].ToString());
                            expiry = Convert.ToDateTime(row["FR_END"]);
                            break;
                        }
                    }

                    adapt = new SqlDataAdapter("Select * from branch", sqlconnect);
                    dsReq = new DataSet();

                    adapt.Fill(dsReq, "branch");
                    tblReq = dsReq.Tables["branch"];


                    foreach (DataRow row in tblReq.Rows)
                    {
                        if (brID == Convert.ToInt32(row["id"].ToString()))
                        {
                            uID = Convert.ToInt32(row["BR_OWNERID"].ToString());
                            break;
                        }
                    }
                    sqlconnect.Close();
                    SQLManager.SQLDelLicenseReq(reqID);
                    SQLManager.SQLAddNotif(msg, uID);
                }
            }
            Response.Redirect("RenewalRequest.aspx");
        }
Ejemplo n.º 45
0
 public AccountBAL()
 {
     sql = new SQLManager();
 }
Ejemplo n.º 46
0
        public void GetChecked(string msg)
        {
            int      reqID  = -1;
            int      brID   = -1;
            int      years  = -1;
            int      frID   = -1;
            int      uID    = -1;
            DateTime expiry = DateTime.Now;

            foreach (GridViewRow gvrow in gvRequests.Rows)
            {
                CheckBox chk = (CheckBox)gvrow.FindControl("cbSelect");
                if (chk != null && chk.Checked)
                {
                    reqID = Convert.ToInt32(gvrow.Cells[1].Text);
                    var    cs         = ConfigurationManager.ConnectionStrings["ZoomDB"];
                    string connection = cs.ConnectionString;

                    SqlConnection  sqlconnect = new SqlConnection(connection);
                    SqlDataAdapter adapt      = new SqlDataAdapter("Select * from renewalRequests", sqlconnect);
                    DataSet        dsReq      = new DataSet();

                    adapt.Fill(dsReq, "renewalRequests");
                    DataTable tblReq;
                    tblReq = dsReq.Tables["renewalRequests"];


                    foreach (DataRow row in tblReq.Rows)
                    {
                        if (reqID == Convert.ToInt32(row["id"].ToString()))
                        {
                            brID  = Convert.ToInt32(row["brID"]);
                            years = Convert.ToInt32(row["years"]);
                            break;
                        }
                    }



                    adapt = new SqlDataAdapter("Select * from franchise", sqlconnect);
                    dsReq = new DataSet();

                    adapt.Fill(dsReq, "franchise");
                    tblReq = dsReq.Tables["franchise"];


                    foreach (DataRow row in tblReq.Rows)
                    {
                        if (brID == Convert.ToInt32(row["BRANCH_ID"].ToString()))
                        {
                            frID   = Convert.ToInt32(row["id"].ToString());
                            expiry = Convert.ToDateTime(row["FR_END"]);
                            break;
                        }
                    }

                    adapt = new SqlDataAdapter("Select * from branch", sqlconnect);
                    dsReq = new DataSet();

                    adapt.Fill(dsReq, "branch");
                    tblReq = dsReq.Tables["branch"];


                    foreach (DataRow row in tblReq.Rows)
                    {
                        if (brID == Convert.ToInt32(row["id"].ToString()))
                        {
                            uID = Convert.ToInt32(row["BR_OWNERID"].ToString());
                            break;
                        }
                    }
                    sqlconnect.Close();
                    expiry = expiry.AddYears(years);
                    SQLManager.SQLRenew(frID, expiry);
                    SQLManager.SQLDelLicenseReq(reqID);
                    SQLManager.SQLAddNotif(msg, uID);
                }
            }
        }
Ejemplo n.º 47
0
 private Object darDeAltaRuta(List<string> listaServiciosAAgregar)
 {
     SQLManager sqlManager = new SQLManager();
     return sqlManager.generarSP("AltaRuta")
                      .agregarIntSP("@Codigo", txtCodigo)
                      .agregarListaSP("@Servicios", listaServiciosAAgregar)
                      .agregarStringSP("@CiudadOrigen", txtCiudadOrigen)
                      .agregarStringSP("@CiudadDestino", txtCiudadDestino)
                      .agregarDecimalSP("@PrecioPasaje", enDecimal(txtPrecioPasaje.Text))
                      .agregarDecimalSP("@PrecioeEncomienda", enDecimal(txtPrecioEncomienda.Text))
                      .ejecutarSP();
 }
Ejemplo n.º 48
0
 private Object darDeBajaRol(string nombre)
 {
     SQLManager sqlManager = new SQLManager();
     return sqlManager.generarSP("BajaRol")
                      .agregarStringSP("@Nombre", nombre)
                      .ejecutarSP();
 }